Class: Drillbit::Authorizers::Scope
- Inherits:
-
Object
- Object
- Drillbit::Authorizers::Scope
- Defined in:
- lib/drillbit/authorizers/scope.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#params ⇒ Object
Returns the value of attribute params.
-
#scope_root ⇒ Object
Returns the value of attribute scope_root.
-
#token ⇒ Object
Returns the value of attribute token.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(action:, token:, user:, issuer:, params:, scope_root:, **other) ⇒ Scope
constructor
rubocop:disable Metrics/ParameterLists.
- #public_scope ⇒ Object
-
#user_scope ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(action:, token:, user:, issuer:, params:, scope_root:, **other) ⇒ Scope
rubocop:disable Metrics/ParameterLists
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/drillbit/authorizers/scope.rb', line 15 def initialize(action:, token:, user:, issuer:, params:, scope_root:, **other) self.action = action self.token = token self.user = user self.params = params self.scope_root = scope_root other.each do |name, value| public_send("#{name}=", value) end end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
8 9 10 |
# File 'lib/drillbit/authorizers/scope.rb', line 8 def action @action end |
#params ⇒ Object
Returns the value of attribute params.
8 9 10 |
# File 'lib/drillbit/authorizers/scope.rb', line 8 def params @params end |
#scope_root ⇒ Object
Returns the value of attribute scope_root.
8 9 10 |
# File 'lib/drillbit/authorizers/scope.rb', line 8 def scope_root @scope_root end |
#token ⇒ Object
Returns the value of attribute token.
8 9 10 |
# File 'lib/drillbit/authorizers/scope.rb', line 8 def token @token end |
#user ⇒ Object
Returns the value of attribute user.
8 9 10 |
# File 'lib/drillbit/authorizers/scope.rb', line 8 def user @user end |
Instance Method Details
#call ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/drillbit/authorizers/scope.rb', line 36 def call if scope_user_id user_scope else public_scope end end |
#public_scope ⇒ Object
32 33 34 |
# File 'lib/drillbit/authorizers/scope.rb', line 32 def public_scope scope_root.none end |
#user_scope ⇒ Object
rubocop:enable Metrics/ParameterLists
28 29 30 |
# File 'lib/drillbit/authorizers/scope.rb', line 28 def user_scope scope_root.public_send("for_#{user_underscored_class_name}", scope_user_id) end |