Class: Decidim::FeedsUi::Admin::Permissions

Inherits:
DefaultPermissions
  • Object
show all
Defined in:
app/permissions/decidim/feeds_ui/admin/permissions.rb

Instance Method Summary collapse

Instance Method Details

#can_access?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'app/permissions/decidim/feeds_ui/admin/permissions.rb', line 16

def can_access?
  permission_action.subject == :feeds_ui &&
    permission_action.action == :read
end

#permissionsObject



7
8
9
10
11
12
13
14
# File 'app/permissions/decidim/feeds_ui/admin/permissions.rb', line 7

def permissions
  return permission_action if permission_action.scope != :admin
  return permission_action unless user&.admin?

  allow! if can_access?

  permission_action
end