Class: Decidim::Assemblies::Abilities::Admin::AssemblyModeratorAbility

Inherits:
AssemblyRoleAbility show all
Defined in:
app/models/decidim/assemblies/abilities/admin/assembly_moderator_ability.rb

Overview

Defines the abilities for an assembly moderator user. Intended to be used with ‘cancancan`.

Instance Method Summary collapse

Methods inherited from AssemblyRoleAbility

#assemblies_with_role_privileges, #can_manage_assembly?, #current_assembly, #define_assembly_abilities, #has_manageable_assemblies?, #initialize, #not_admin?

Constructor Details

This class inherits a constructor from Decidim::Assemblies::Abilities::Admin::AssemblyRoleAbility

Instance Method Details

#define_abilitiesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/decidim/assemblies/abilities/admin/assembly_moderator_ability.rb', line 10

def define_abilities
  super

  can [:index, :read], Assembly do |assembly|
    can_manage_assembly?(assembly)
  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

#roleObject



26
27
28
# File 'app/models/decidim/assemblies/abilities/admin/assembly_moderator_ability.rb', line 26

def role
  :moderator
end