6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/permissions/decidim/budgets/permissions.rb', line 6
def permissions
return permission_action unless user
return Decidim::Budgets::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
return permission_action if permission_action.scope != :public
return permission_action unless [:project, :order].include? permission_action.subject
if permission_action.subject == :project
case permission_action.action
when :vote
can_vote?(false) if can_vote_project?(project || order&.projects&.first)
when :report
permission_action.allow!
end
end
can_vote?(true) if permission_action.action == :create && permission_action.subject == :order
permission_action
end
|