Class: Decidim::Initiatives::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-initiatives/app/permissions/decidim/initiatives/permissions.rb

Instance Method Summary collapse

Methods inherited from DefaultPermissions

#initialize

Constructor Details

This class inherits a constructor from Decidim::DefaultPermissions

Instance Method Details

#permissionsObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'decidim-initiatives/app/permissions/decidim/initiatives/permissions.rb', line 6

def permissions
  # Delegate the admin permission checks to the admin permissions class
  return Decidim::Initiatives::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
  return permission_action if permission_action.scope != :public

  # Non-logged users permissions
  list_public_initiatives?
  read_public_initiative?
  search_initiative_types_and_scopes?
  request_membership?

  return permission_action unless user

  create_initiative?
  edit_public_initiative?
  update_public_initiative?

  vote_initiative?
  sign_initiative?
  unvote_initiative?

  initiative_attachment?

  initiative_committee_action?
  send_to_technical_validation?

  permission_action
end