Class: Cerbos::Output::CheckResources::Result::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/output/check_resources.rb

Overview

Additional information about how policy decisions were reached.

Defined Under Namespace

Classes: Effect

Instance Attribute Summary collapse

Instance Attribute Details

#actionsHash{String => Effect} (readonly)

Additional information about how the policy decision was reached for each action.

Returns:



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/cerbos/output/check_resources.rb', line 190

CheckResources::Result::Metadata = Output.new_class(:actions, :effective_derived_roles) do
  # @!attribute [r] actions
  #   Additional information about how the policy decision was reached for each action.
  #
  #   @return [Hash{String => Effect}]

  # @!attribute [r] effective_derived_roles
  #   The derived roles that were applied to the principal for the resource.
  #
  #   @return [Array<String>]
  #
  #   @see https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html Derived roles

  def self.from_protobuf(meta)
    return nil if meta.nil?

    new(
      actions: meta.actions.map { |action, effect| [action, CheckResources::Result::Metadata::Effect.from_protobuf(effect)] }.to_h,
      effective_derived_roles: meta.effective_derived_roles || []
    )
  end
end

#effective_derived_rolesArray<String> (readonly)

The derived roles that were applied to the principal for the resource.

Returns:

  • (Array<String>)

See Also:



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/cerbos/output/check_resources.rb', line 190

CheckResources::Result::Metadata = Output.new_class(:actions, :effective_derived_roles) do
  # @!attribute [r] actions
  #   Additional information about how the policy decision was reached for each action.
  #
  #   @return [Hash{String => Effect}]

  # @!attribute [r] effective_derived_roles
  #   The derived roles that were applied to the principal for the resource.
  #
  #   @return [Array<String>]
  #
  #   @see https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html Derived roles

  def self.from_protobuf(meta)
    return nil if meta.nil?

    new(
      actions: meta.actions.map { |action, effect| [action, CheckResources::Result::Metadata::Effect.from_protobuf(effect)] }.to_h,
      effective_derived_roles: meta.effective_derived_roles || []
    )
  end
end