Module: Pragma::Operation::Authorization::ClassMethods
- Defined in:
- lib/pragma/operation/authorization.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#build_policy(user:, resource:) ⇒ Pragma::Policy::Base
Builds the policy for the given user and resource, using the previous defined policy class.
-
#policy(klass) ⇒ Object
Sets the policy to use for authorizing this operation.
-
#policy_klass ⇒ Class
Returns the policy class.
Instance Method Details
#build_policy(user:, resource:) ⇒ Pragma::Policy::Base
Builds the policy for the given user and resource, using the previous defined policy class.
37 38 39 |
# File 'lib/pragma/operation/authorization.rb', line 37 def build_policy(user:, resource:) policy_klass.new(user: user, resource: resource) end |
#policy(klass) ⇒ Object
Sets the policy to use for authorizing this operation.
17 18 19 |
# File 'lib/pragma/operation/authorization.rb', line 17 def policy(klass) @policy = klass end |
#policy_klass ⇒ Class
Returns the policy class.
24 25 26 |
# File 'lib/pragma/operation/authorization.rb', line 24 def policy_klass @policy end |