Class: Decidim::ActionDelegator::Permissions

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

Constant Summary collapse

SUBJECTS_WHITELIST =
[:delegation, :ponderation, :participant, :setting, :consultation].freeze

Instance Method Summary collapse

Instance Method Details

#permissionsObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/permissions/decidim/action_delegator/permissions.rb', line 8

def permissions
  allowed_delegation_action?

  return permission_action unless user && user.admin?
  return permission_action unless permission_action.scope == :admin
  return permission_action unless action_delegator_subject?

  allow! if can_perform_action?

  permission_action
end