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
-
#attr ⇒ 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
-
#attributes ⇒ Attributes
deprecated
Deprecated.
Use #attr instead.
-
#initialize(kind:, id:, attr: {}, attributes: nil, policy_version: nil, scope: nil) ⇒ Resource
constructor
Specify a resource on which to check a principal's permissions.
Constructor Details
#initialize(kind:, id:, attr: {}, attributes: nil, policy_version: nil, scope: nil) ⇒ Resource
Specify a resource on which to check a principal's permissions.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cerbos/input/resource.rb', line 44 def initialize(kind:, id:, attr: {}, attributes: nil, policy_version: nil, scope: nil) unless attributes.nil? Cerbos.deprecation_warning "The `attributes` keyword argument is deprecated. Use `attr` instead." attr = attributes end @kind = kind @id = id @attr = Input.coerce_required(attr, Attributes) @policy_version = policy_version @scope = scope end |
Instance Attribute Details
#attr ⇒ Attributes (readonly)
Application-specific attributes describing the resource.
20 21 22 |
# File 'lib/cerbos/input/resource.rb', line 20 def attr @attr 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 |
Instance Method Details
#attributes ⇒ Attributes
Use #attr instead.
Application-specific attributes describing the resource.
61 62 63 64 |
# File 'lib/cerbos/input/resource.rb', line 61 def attributes Cerbos.deprecation_warning "The `attributes` method is deprecated. Use `attr` instead." attr end |