7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/permissions/decidim/templates/admin/permissions.rb', line 7
def permissions
return permission_action if permission_action.scope != :admin
return permission_action unless user
return permission_action if context[:current_organization] != user.organization
if user_has_a_role? && (permission_action.subject == :template && permission_action.action == :read)
allow!
else
return permission_action unless user.admin?
case permission_action.subject
when :template
allow! if [:read, :create, :update, :destroy, :copy].include? permission_action.action
when :templates
allow! if permission_action.action == :index
when :questionnaire
allow!
end
end
permission_action
end
|