6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/permissions/decidim/elections/permissions.rb', line 6
def permissions
if permission_action.scope == :public && permission_action.subject == :election
case permission_action.action
when :preview
toggle_allow(can_preview?)
when :view
toggle_allow(can_view?)
when :vote
toggle_allow(can_vote?)
when :user_vote
toggle_allow(can_vote_with_user?)
end
end
return permission_action unless user
return Decidim::Elections::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
return Decidim::Elections::TrusteeZone::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :trustee_zone
permission_action
end
|