Class: Cerbos::Input::ResourceCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/input/resource_check.rb

Overview

A resource and actions to check a principal's permissions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:, actions:) ⇒ ResourceCheck

Specify a resource and actions to check a principal's permissions.

Parameters:

  • resource (Resource, Hash)

    the resource to check.

  • actions (Array<String>)

    the actions to check.


21
22
23
24
# File 'lib/cerbos/input/resource_check.rb', line 21

def initialize(resource:, actions:)
  @resource = Input.coerce_required(resource, Resource)
  @actions = actions
end

Instance Attribute Details

#actionsArray<String> (readonly)

The actions to check.

Returns:

  • (Array<String>)

15
16
17
# File 'lib/cerbos/input/resource_check.rb', line 15

def actions
  @actions
end

#resourceResource (readonly)

The resource to check.

Returns:


10
11
12
# File 'lib/cerbos/input/resource_check.rb', line 10

def resource
  @resource
end