Sha256: 4c5a4a4976be93c1ed9f12c7a3849610259d9d40a7d9b059d169e0ec1602037e

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

module Conjur::Policy::Executor
  class Revoke < Base
    def execute
      if statement.role.is_a?(Conjur::Policy::Types::Layer) && statement.member.is_a?(Conjur::Policy::Types::Host)
        remove_host_from_layer
      else
        revoke_role_from_member
      end
    end
    
    def remove_host_from_layer
      action({
        'method' => 'delete',
        'path' => "layers/#{fully_escape statement.role.id}/hosts/#{fully_escape statement.member.roleid}",
        'parameters' => {}
      })
    end
    
    def revoke_role_from_member
      action({
        'method' => 'delete',
        'path' => "#{role_path(statement.role)}?members",
        'parameters' => { "member" => statement.member.roleid }
      })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conjur-asset-policy-0.13.0 lib/conjur/policy/executor/revoke.rb
conjur-asset-policy-0.12.0 lib/conjur/policy/executor/revoke.rb
conjur-asset-policy-0.11.0 lib/conjur/policy/executor/revoke.rb