Class: Decidim::ParticipatorySpaceRoleConfig::Base
- Inherits:
-
Object
- Object
- Decidim::ParticipatorySpaceRoleConfig::Base
- Defined in:
- app/models/decidim/participatory_space_role_config/base.rb
Direct Known Subclasses
Admin, Collaborator, Moderator, NullObject, ParticipatorySpaceAdmin, Valuator
Instance Method Summary collapse
-
#accepted_components ⇒ Object
Public: Lists the names of the accepted components for this role.
-
#component_is_accessible?(manifest_name) ⇒ Boolean
Checks whether the given manifest name is accepted for this role.
-
#initialize(user_role) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(user_role) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'app/models/decidim/participatory_space_role_config/base.rb', line 6 def initialize(user_role) @user_role = user_role end |
Instance Method Details
#accepted_components ⇒ Object
Public: Lists the names of the accepted components for this role.
Returns an Array of Symbols.
22 23 24 |
# File 'app/models/decidim/participatory_space_role_config/base.rb', line 22 def accepted_components [:all] end |
#component_is_accessible?(manifest_name) ⇒ Boolean
Checks whether the given manifest name is accepted for this role.
Returns a boolean.
13 14 15 16 17 |
# File 'app/models/decidim/participatory_space_role_config/base.rb', line 13 def component_is_accessible?(manifest_name) return true if accepted_components == [:all] accepted_components.include?(manifest_name.to_sym) end |