Class: Avo::Services::AuthorizationService
- Inherits:
-
Object
- Object
- Avo::Services::AuthorizationService
- Defined in:
- lib/avo/services/authorization_service.rb
Defined Under Namespace
Classes: NilPolicy
Instance Attribute Summary collapse
-
#policy_class ⇒ Object
Returns the value of attribute policy_class.
-
#record ⇒ Object
Returns the value of attribute record.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
- #apply_policy(query) ⇒ Object
- #authorize_action(*args) ⇒ Object
- #has_method?(*args, **kwargs) ⇒ Boolean
-
#initialize(user = nil, record = nil, policy_class: nil) ⇒ AuthorizationService
constructor
A new instance of AuthorizationService.
- #set_record(record) ⇒ Object
Constructor Details
#initialize(user = nil, record = nil, policy_class: nil) ⇒ AuthorizationService
Returns a new instance of AuthorizationService.
18 19 20 21 22 |
# File 'lib/avo/services/authorization_service.rb', line 18 def initialize(user = nil, record = nil, policy_class: nil) @user = user @record = record @policy_class = NilPolicy end |
Instance Attribute Details
#policy_class ⇒ Object
Returns the value of attribute policy_class.
6 7 8 |
# File 'lib/avo/services/authorization_service.rb', line 6 def policy_class @policy_class end |
#record ⇒ Object
Returns the value of attribute record.
5 6 7 |
# File 'lib/avo/services/authorization_service.rb', line 5 def record @record end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/avo/services/authorization_service.rb', line 4 def user @user end |
Class Method Details
.apply_policy(user, query) ⇒ Object
13 14 15 |
# File 'lib/avo/services/authorization_service.rb', line 13 def apply_policy(user, query) query end |
.authorize(*args, **kwargs) ⇒ Object
9 10 11 |
# File 'lib/avo/services/authorization_service.rb', line 9 def (*args, **kwargs) true end |
Instance Method Details
#apply_policy(query) ⇒ Object
30 31 32 |
# File 'lib/avo/services/authorization_service.rb', line 30 def apply_policy(query) query end |
#authorize_action(*args) ⇒ Object
34 35 36 |
# File 'lib/avo/services/authorization_service.rb', line 34 def (*args) true end |
#has_method?(*args, **kwargs) ⇒ Boolean
38 39 40 |
# File 'lib/avo/services/authorization_service.rb', line 38 def has_method?(*args, **kwargs) false end |
#set_record(record) ⇒ Object
24 25 26 27 28 |
# File 'lib/avo/services/authorization_service.rb', line 24 def set_record(record) @record = record self end |