Class: AccessAllow::Roles
- Inherits:
-
Object
- Object
- AccessAllow::Roles
- Defined in:
- lib/access_allow/roles.rb
Class Method Summary collapse
-
.for?(type, role) ⇒ Boolean
Check roles are valid for specific user types.
-
.humanized_name(type, role) ⇒ Object
Get a human readable version of the role key.
- .roles_for(type) ⇒ Object
Class Method Details
.for?(type, role) ⇒ Boolean
Check roles are valid for specific user types
13 14 15 |
# File 'lib/access_allow/roles.rb', line 13 def for?(type, role) roles_for(type).include?(role.to_sym) end |
.humanized_name(type, role) ⇒ Object
Get a human readable version of the role key
7 8 9 |
# File 'lib/access_allow/roles.rb', line 7 def humanized_name(type, role) I18n.t("abilities.#{type}.roles.#{role}") end |
.roles_for(type) ⇒ Object
17 18 19 |
# File 'lib/access_allow/roles.rb', line 17 def roles_for(type) configuration[type.to_sym]&.keys || [] end |