Class: KittyPolicy::GraphQL::FieldAuthorization
- Inherits:
-
Object
- Object
- KittyPolicy::GraphQL::FieldAuthorization
- Defined in:
- lib/kitty_policy/graphql/field_authorization.rb
Instance Method Summary collapse
-
#initialize(policy:, current_user_key: :current_user) ⇒ FieldAuthorization
constructor
A new instance of FieldAuthorization.
- #instrument(_type, field) ⇒ Object
Constructor Details
#initialize(policy:, current_user_key: :current_user) ⇒ FieldAuthorization
Returns a new instance of FieldAuthorization.
6 7 8 9 |
# File 'lib/kitty_policy/graphql/field_authorization.rb', line 6 def initialize(policy:, current_user_key: :current_user) @policy = policy @current_user_key = current_user_key end |
Instance Method Details
#instrument(_type, field) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/kitty_policy/graphql/field_authorization.rb', line 11 def instrument(_type, field) return (field) if field..key?(:authorize) return (field) if field..key?(:authorize_object) field end |