Class: Machina::Middleware::Authentication::Hints
- Inherits:
-
Data
- Object
- Data
- Machina::Middleware::Authentication::Hints
- Defined in:
- lib/machina/middleware/authentication/hints.rb
Instance Attribute Summary collapse
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#workspace ⇒ Object
readonly
Returns the value of attribute workspace.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#organization ⇒ Object (readonly)
Returns the value of attribute organization
26 27 28 |
# File 'lib/machina/middleware/authentication/hints.rb', line 26 def organization @organization end |
#workspace ⇒ Object (readonly)
Returns the value of attribute workspace
26 27 28 |
# File 'lib/machina/middleware/authentication/hints.rb', line 26 def workspace @workspace end |
Class Method Details
.from(env, request) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/machina/middleware/authentication/hints.rb', line 27 def self.from(env, request) new( workspace: env['machina.workspace_hint'].presence || request.headers['X-Machina-Workspace-Hint'].presence, organization: env['machina.organization_hint'].presence || request.headers['X-Machina-Organization-Hint'].presence, ) end |
Instance Method Details
#cache_suffix ⇒ Object
47 48 49 |
# File 'lib/machina/middleware/authentication/hints.rb', line 47 def cache_suffix empty? ? '' : ":#{organization}:#{workspace}" end |
#empty? ⇒ Boolean
36 37 38 |
# File 'lib/machina/middleware/authentication/hints.rb', line 36 def empty? workspace.nil? && organization.nil? end |
#to_resolve_kwargs ⇒ Object
40 41 42 43 44 45 |
# File 'lib/machina/middleware/authentication/hints.rb', line 40 def to_resolve_kwargs kwargs = {} kwargs[HINT_UUID_RE.match?(workspace) ? :workspace_id : :workspace_slug] = workspace if workspace kwargs[:organization_slug] = organization if organization kwargs end |