Class: Decidim::Assemblies::Abilities::AssemblyRoleAbility
- Inherits:
-
Object
- Object
- Decidim::Assemblies::Abilities::AssemblyRoleAbility
- Includes:
- CanCan::Ability
- Defined in:
- app/models/decidim/assemblies/abilities/assembly_role_ability.rb
Overview
Defines the abilities for any user that can manage assemblies (whatever their role). Intended to be used with ‘cancancan`.
Direct Known Subclasses
AssemblyAdminAbility, AssemblyCollaboratorAbility, AssemblyModeratorAbility
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #define_abilities ⇒ Object
-
#initialize(user, context) ⇒ AssemblyRoleAbility
constructor
A new instance of AssemblyRoleAbility.
Constructor Details
#initialize(user, context) ⇒ AssemblyRoleAbility
Returns a new instance of AssemblyRoleAbility.
13 14 15 16 17 18 |
# File 'app/models/decidim/assemblies/abilities/assembly_role_ability.rb', line 13 def initialize(user, context) @user = user @context = context define_abilities if not_admin? && has_manageable_assemblies? end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
11 12 13 |
# File 'app/models/decidim/assemblies/abilities/assembly_role_ability.rb', line 11 def user @user end |
Instance Method Details
#define_abilities ⇒ Object
20 21 22 23 |
# File 'app/models/decidim/assemblies/abilities/assembly_role_ability.rb', line 20 def define_abilities can :read, :admin_dashboard can :read, Assembly end |