Class: EasyAdmin::Permissions::UserRolePermissionsComponent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- EasyAdmin::Permissions::UserRolePermissionsComponent
- Defined in:
- app/components/easy_admin/permissions/user_role_permissions_component.rb
Instance Method Summary collapse
-
#initialize(user:) ⇒ UserRolePermissionsComponent
constructor
A new instance of UserRolePermissionsComponent.
- #view_template ⇒ Object
Methods inherited from BaseComponent
#easy_admin_url_helpers, #helpers, #rails_url_helpers
Methods included from Component
#current_user_can?, #current_user_has_role?, #if_can, #if_has_role, #permission_attrs, #permission_button, #permission_case, #permission_classes, #permission_field, #permission_link, #unless_can, #unless_has_role
Methods included from FieldsHelper
#field_component, #render_field
Methods included from DashboardsHelper
#delta_badge_classes, #metric_value_classes, #render_card, #sparkline_color, #sparkline_points, #trend_direction, #trend_icon, #trend_indicator_classes
Constructor Details
#initialize(user:) ⇒ UserRolePermissionsComponent
Returns a new instance of UserRolePermissionsComponent.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/components/easy_admin/permissions/user_role_permissions_component.rb', line 4 def initialize(user:) @user = user # Use direct role association for role info if user && user.respond_to?(:role) user.reload if user.persisted? @current_role = user.role else @current_role = nil end # Get actual permissions from permissions_cache @user_permissions = (user) @available_resources = EasyAdmin::Permissions.available_resources end |
Instance Method Details
#view_template ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/components/easy_admin/permissions/user_role_permissions_component.rb', line 19 def view_template div(class: "space-y-6") do # Current Role Section render_current_role_section # Individual Permissions Section (from cache) end end |