Class: Conjur::Policy::Types::Permit
- Includes:
- ResourceMemberDSL
- Defined in:
- lib/conjur/policy/types/permit.rb
Instance Method Summary collapse
-
#initialize(privilege = nil) ⇒ Permit
constructor
A new instance of Permit.
- #to_s ⇒ Object
Methods included from ResourceMemberDSL
Methods inherited from Base
#custom_attribute_names, #id_attribute, inherited, #referenced_records, register_yaml_type, #resource?, #role?, short_name
Methods included from InheritableAttribute
inherit_for, #inheritable_attr
Methods included from TypeChecking
#expect_array, #expect_boolean, #expect_hash, #expect_integer, #expect_layer, #expect_member, #expect_permission, #expect_record, #expect_resource, #expect_role, #expect_string, #expect_type, #test_resource, #test_role
Methods included from AttributeDefinition
#attribute, #define_field, #define_plural_field, #field?, #yaml_field?, #yaml_field_type
Constructor Details
#initialize(privilege = nil) ⇒ Permit
Returns a new instance of Permit.
42 43 44 |
# File 'lib/conjur/policy/types/permit.rb', line 42 def initialize privilege = nil self.privilege = privilege end |
Instance Method Details
#to_s ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/conjur/policy/types/permit.rb', line 46 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 |