Class: Decidim::Proposals::Admin::Permissions
- Inherits:
-
DefaultPermissions
- Object
- DefaultPermissions
- Decidim::Proposals::Admin::Permissions
- Defined in:
- decidim-proposals/app/permissions/decidim/proposals/admin/permissions.rb
Instance Method Summary collapse
Methods inherited from DefaultPermissions
Constructor Details
This class inherits a constructor from Decidim::DefaultPermissions
Instance Method Details
#permissions ⇒ Object
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'decidim-proposals/app/permissions/decidim/proposals/admin/permissions.rb', line 7 def # The public part needs to be implemented yet return if .scope != :admin # Valuators can only perform these actions if user_is_valuator? if valuator_assigned_to_proposal? can_create_proposal_note? can_create_proposal_answer? end can_export_proposals? valuator_can_unassign_valuator_from_proposals? return end if can_create_proposal_note? can_create_proposal_from_admin? can_create_proposal_answer? end # Admins can only edit official proposals if they are within the # time limit. allow! if .subject == :proposal && .action == :edit && admin_edition_is_available? # Every user allowed by the space can update the category of the proposal allow! if .subject == :proposal_category && .action == :update # Every user allowed by the space can update the scope of the proposal allow! if .subject == :proposal_scope && .action == :update # Every user allowed by the space can import proposals from another_component allow! if .subject == :proposals && .action == :import # Every user allowed by the space can export proposals can_export_proposals? # Every user allowed by the space can merge proposals to another component allow! if .subject == :proposals && .action == :merge # Every user allowed by the space can split proposals to another component allow! if .subject == :proposals && .action == :split # Every user allowed by the space can assign proposals to a valuator allow! if .subject == :proposals && .action == :assign_to_valuator # Every user allowed by the space can unassign a valuator from proposals can_unassign_valuator_from_proposals? # Only admin users can publish many answers at once toggle_allow(user.admin?) if .subject == :proposals && .action == :publish_answers if .subject == :participatory_texts && participatory_texts_are_enabled? && .action == :manage # Every user allowed by the space can manage (import, update and publish) participatory texts to proposals allow! end end |