Sha256: 6cea353b43f47bb54be3fd0c2e53251415b99d336131330874d3a2c2faf9e75a
Contents?: true
Size: 1.86 KB
Versions: 3
Compression:
Stored size: 1.86 KB
Contents
# frozen_string_literal: true module Decidim module Admin module Abilities # Defines the abilities for a participatory process admin in the admin # section. Intended to be used with `cancancan`. This is not intended to # extend the base `Decidim::Abilities::BaseAbility` class, it should only # be used in the Admin engine. # # This ability will not apply to organization admins. class ParticipatoryProcessAdminAbility < Decidim::Abilities::ParticipatoryProcessAdminAbility def define_abilities super can :manage, ParticipatoryProcess do |process| can_manage_process?(process) end cannot :create, ParticipatoryProcess cannot :destroy, ParticipatoryProcess end def define_participatory_process_abilities super can :manage, Component do |component| can_manage_process?(component.participatory_space) end can :manage, Category do |category| can_manage_process?(category.participatory_space) end can :manage, AttachmentCollection do |attachment_collection| can_manage_process?(attachment_collection.collection_for) end can :manage, Attachment do |attachment| attachment.attached_to.is_a?(Decidim::ParticipatoryProcess) && can_manage_process?(attachment.attached_to) end can :manage, ParticipatoryProcessUserRole do |role| can_manage_process?(role.participatory_process) && role.user != @user end can :manage, Moderation do |moderation| can_manage_process?(moderation.participatory_space) end can :manage, ParticipatoryProcessStep do |step| can_manage_process?(step.participatory_process) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems