Class: Cerbos::Input::Resource
- Inherits:
-
Object
- Object
- Cerbos::Input::Resource
- Defined in:
- lib/cerbos/input/resource.rb
Overview
A resource on which to check a principal's permissions.
Instance Attribute Summary collapse
-
#attributes ⇒ Attributes
readonly
Application-specific attributes describing the resource.
-
#id ⇒ String
readonly
A unique identifier for the resource.
-
#kind ⇒ String
readonly
The type of resource.
-
#policy_version ⇒ String?
readonly
The policy version to use when checking the principal's permissions on the resource.
-
#scope ⇒ String?
readonly
The policy scope to use when checking the principal's permissions on the resource.
Instance Method Summary collapse
-
#initialize(kind:, id:, attributes: {}, policy_version: nil, scope: nil) ⇒ Resource
constructor
Specify a resource on which to check a principal's permissions.
Constructor Details
#initialize(kind:, id:, attributes: {}, policy_version: nil, scope: nil) ⇒ Resource
Specify a resource on which to check a principal's permissions.
43 44 45 46 47 48 49 |
# File 'lib/cerbos/input/resource.rb', line 43 def initialize(kind:, id:, attributes: {}, policy_version: nil, scope: nil) @kind = kind @id = id @attributes = Input.coerce_required(attributes, Attributes) @policy_version = policy_version @scope = scope end |
Instance Attribute Details
#attributes ⇒ Attributes (readonly)
Application-specific attributes describing the resource.
20 21 22 |
# File 'lib/cerbos/input/resource.rb', line 20 def attributes @attributes end |
#id ⇒ String (readonly)
A unique identifier for the resource.
15 16 17 |
# File 'lib/cerbos/input/resource.rb', line 15 def id @id end |
#kind ⇒ String (readonly)
The type of resource.
10 11 12 |
# File 'lib/cerbos/input/resource.rb', line 10 def kind @kind end |
#policy_version ⇒ String? (readonly)
The policy version to use when checking the principal's permissions on the resource.
26 27 28 |
# File 'lib/cerbos/input/resource.rb', line 26 def policy_version @policy_version end |
#scope ⇒ String? (readonly)
The policy scope to use when checking the principal's permissions on the resource.
34 35 36 |
# File 'lib/cerbos/input/resource.rb', line 34 def scope @scope end |