lib/conjur/acts_as_asset.rb in conjur-api-4.1.1 vs lib/conjur/acts_as_asset.rb in conjur-api-4.3.0
- old
+ new
@@ -27,7 +27,24 @@
include HasOwner
include ActsAsResource
include HasAttributes
end
end
+
+ def add_member(role_name, member, options = {})
+ owned_role(role_name).grant_to member, options
+ end
+
+ def remove_member(role_name, member)
+ owned_role(role_name).revoke_from member
+ end
+
+ protected
+
+ def owned_role(role_name)
+ tokens = [ resource_kind, resource_id, role_name ]
+ grant_role = [ core_conjur_account, '@', tokens.join('/') ].join(':')
+ require 'conjur/role'
+ Conjur::Role.new(Conjur::Authz::API.host, self.options)[Conjur::API.parse_role_id(grant_role).join('/')]
+ end
end
end
\ No newline at end of file