Class: Drillbit::Authorizers::Scope
- Inherits:
-
Object
- Object
- Drillbit::Authorizers::Scope
- Defined in:
- lib/drillbit/authorizers/scope.rb
Instance Attribute Summary collapse
-
#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(token:, user:, params:, scope_root:, **other) ⇒ Scope
constructor
A new instance of Scope.
- #public_scope ⇒ Object
- #user_scope ⇒ Object
Constructor Details
#initialize(token:, user:, params:, scope_root:, **other) ⇒ Scope
Returns a new instance of Scope.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/drillbit/authorizers/scope.rb', line 12 def initialize(token:, user:, params:, scope_root:, **other) 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
#params ⇒ Object
Returns the value of attribute params.
7 8 9 |
# File 'lib/drillbit/authorizers/scope.rb', line 7 def params @params end |
#scope_root ⇒ Object
Returns the value of attribute scope_root.
7 8 9 |
# File 'lib/drillbit/authorizers/scope.rb', line 7 def scope_root @scope_root end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/drillbit/authorizers/scope.rb', line 7 def token @token end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/drillbit/authorizers/scope.rb', line 7 def user @user end |
Instance Method Details
#call ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/drillbit/authorizers/scope.rb', line 31 def call if scope_user_id user_scope else public_scope end end |
#public_scope ⇒ Object
27 28 29 |
# File 'lib/drillbit/authorizers/scope.rb', line 27 def public_scope scope_root.none end |
#user_scope ⇒ Object
23 24 25 |
# File 'lib/drillbit/authorizers/scope.rb', line 23 def user_scope scope_root.public_send("for_#{user_underscored_class_name}", scope_user_id) end |