Class: Arrthorizer::Role
- Inherits:
-
Object
- Object
- Arrthorizer::Role
- Defined in:
- lib/arrthorizer/role.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#applies_to_user?(user, context = {}) ⇒ Boolean
Template method: This method is implemented in the ContextRole subclasses and Group.
- #to_key ⇒ Object
Class Method Details
.get(name_or_role) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/arrthorizer/role.rb', line 10 def self.get(name_or_role) if name_or_role.respond_to?(:instance) get(name_or_role.instance) else registry.fetch(name_or_role) end end |
.register(role) ⇒ Object
18 19 20 |
# File 'lib/arrthorizer/role.rb', line 18 def self.register(role) registry.add(role) end |
Instance Method Details
#applies_to_user?(user, context = {}) ⇒ Boolean
Template method: This method is implemented in the ContextRole subclasses and Group.
6 7 8 |
# File 'lib/arrthorizer/role.rb', line 6 def applies_to_user?(user, context = {}) raise NotImplementedError, "#{self.name} does not implement #applies_to_user?(user, context)" end |
#to_key ⇒ Object
26 27 28 |
# File 'lib/arrthorizer/role.rb', line 26 def to_key name end |