Class: ActionGuard::ExactRoleRule
- Inherits:
-
Object
- Object
- ActionGuard::ExactRoleRule
- Defined in:
- lib/action-guard/rules.rb
Instance Method Summary collapse
- #allows?(person, request_params) ⇒ Boolean
-
#initialize(role) ⇒ ExactRoleRule
constructor
A new instance of ExactRoleRule.
Constructor Details
#initialize(role) ⇒ ExactRoleRule
Returns a new instance of ExactRoleRule.
3 4 5 |
# File 'lib/action-guard/rules.rb', line 3 def initialize(role) @allowed_role = role.to_s end |
Instance Method Details
#allows?(person, request_params) ⇒ Boolean
6 7 8 9 |
# File 'lib/action-guard/rules.rb', line 6 def allows?(person, request_params) return false unless person return person.role.to_s == @allowed_role end |