Sha256: 3d6bbbc3ef445ec7654be96ec5d06700908ffdb2976fbc8d528ebd999c51863c
Contents?: true
Size: 1.54 KB
Versions: 4
Compression:
Stored size: 1.54 KB
Contents
# frozen_string_literal: true module Decidim module Assemblies module Abilities module Admin # Defines the abilities for an assembly admin user. Intended to be used # with `cancancan`. class AssemblyAdminAbility < Decidim::Assemblies::Abilities::Admin::AssemblyRoleAbility def define_abilities super can :manage, Assembly do |assembly| can_manage_assembly?(assembly) end cannot :create, Assembly cannot :destroy, Assembly end def role :admin end def define_assembly_abilities can :manage, Feature do |feature| can_manage_assembly?(feature.participatory_space) end can :manage, Category do |category| can_manage_assembly?(category.participatory_space) end can :manage, Attachment do |attachment| attachment.attached_to.is_a?(Decidim::Assembly) && can_manage_assembly?(attachment.attached_to) end can :manage, AssemblyUserRole do |role| can_manage_assembly?(role.assembly) && role.user != @user end can :manage, Moderation do |moderation| can_manage_assembly?(moderation.participatory_space) end can [:unreport, :hide], Reportable do |reportable| can_manage_assembly?(reportable.feature.participatory_space) end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems