Class: Decidim::ParticipatorySpaceRoleConfig::Base

Inherits:
Object
  • Object
show all
Defined in:
decidim-core/app/models/decidim/participatory_space_role_config/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(user_role) ⇒ Base

Returns a new instance of Base.


6
7
8
# File 'decidim-core/app/models/decidim/participatory_space_role_config/base.rb', line 6

def initialize(user_role)
  @user_role = user_role
end

Instance Method Details

#accepted_componentsObject

Public: Lists the names of the accepted components for this role.

Returns an Array of Symbols.


22
23
24
# File 'decidim-core/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.

Returns:

  • (Boolean)

13
14
15
16
17
# File 'decidim-core/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