Class: Rbacan::AuthorizationContext

Inherits:
Object
  • Object
show all
Defined in:
lib/rbacan/host_authorization.rb

Constant Summary collapse

ATTRIBUTES =
i[tenant property vertical subject at ].freeze

Instance Method Summary collapse

Constructor Details

#initialize(tenant:, property: nil, vertical: nil, subject: nil, at: Time.now, metadata: {}) ⇒ AuthorizationContext

Returns a new instance of AuthorizationContext.

Raises:



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rbacan/host_authorization.rb', line 10

def initialize(tenant:, property: nil, vertical: nil, subject: nil, at: Time.now, metadata: {})
  raise ArgumentError, 'authorization tenant must identify a tenant' unless identifying_tenant?(tenant)

  @tenant = deep_copy_and_freeze(tenant, label: 'authorization tenant')
  @property = deep_copy_and_freeze(property, label: 'authorization property')
  @vertical = deep_copy_and_freeze(vertical, label: 'authorization vertical')
  @subject = deep_copy_and_freeze(subject, label: 'authorization subject')
  @at = copy_and_freeze_time(at)
   = deep_copy_and_freeze(, label: 'authorization metadata')
  freeze
end