Sha256: b3c3c992da381a6854b7c62bc6c9b69fe7290aa574893d9009b28e3f08b1c460

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

module Conjur
  module DSL2
    module Types
      class Permit < Base
        attribute :role, kind: :member
        attribute :privilege, kind: :string, dsl_accessor: true
        attribute :resource, dsl_accessor: true
        attribute :replace, kind: :boolean, singular: true, dsl_accessor: true
        
        include ResourceMemberDSL
        
        def initialize privilege = nil
          self.privilege = privilege
        end
        
        def to_s
          if Array === role
            role_string = role.map &:role
            admin = false
          else
            role_string = role.role
            admin = role.admin
          end
          "Permit #{role_string} to [#{Array(privilege).join(', ')}] on #{Array(resource).join(', ')}#{admin ? ' with grant option' : ''}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conjur-asset-dsl2-0.6.1 lib/conjur/dsl2/types/permit.rb
conjur-asset-dsl2-0.6.0 lib/conjur/dsl2/types/permit.rb
conjur-asset-dsl2-0.5.0 lib/conjur/dsl2/types/permit.rb