class Conjur::DSL2::OwnerResolver

Sets the owner field for any records which support it, and don’t have an owner specified. Within a policy, the default owner is the policy role. For global records, the default owner is the ownerid specified in the constructor.

Public Instance Methods

on_resolve_policy(policy, visited) click to toggle source
# File lib/conjur/dsl2/resolver.rb, line 130
def on_resolve_policy policy, visited
  saved_ownerid = @ownerid
  @ownerid = [ policy.account, "policy", policy.id ].join(":")
  traverse policy.body, visited, method(:resolve_owner), method(:on_resolve_policy)
ensure
  @ownerid = saved_ownerid
end
resolve(records) click to toggle source
# File lib/conjur/dsl2/resolver.rb, line 120
def resolve records
  traverse records, Set.new, method(:resolve_owner), method(:on_resolve_policy)
end
resolve_owner(record, visited) click to toggle source
# File lib/conjur/dsl2/resolver.rb, line 124
def resolve_owner record, visited
  if record.respond_to?(:owner) && record.respond_to?(:owner) && record.owner.nil?
    record.owner = Types::Role.new(@ownerid)
  end
end