lib/conjur/base.rb in conjur-api-2.0.1 vs lib/conjur/base.rb in conjur-api-2.1.0
- old
+ new
@@ -1,10 +1,11 @@
require 'rest-client'
require 'json'
require 'conjur/exists'
require 'conjur/has_attributes'
+require 'conjur/path_based'
require 'conjur/escape'
require 'conjur/log'
require 'conjur/log_source'
require 'conjur/standard_methods'
require 'conjur/token_cache'
@@ -14,9 +15,15 @@
include Escape
include LogSource
include StandardMethods
class << self
+ # Parse a role id into [ account, 'roles', kind, id ]
+ def parse_role_id(id)
+ paths = path_escape(id).split(':')
+ [ paths[0], 'roles', paths[1], paths[2..-1].join(':') ]
+ end
+
def new_from_key(username, api_key)
self.new username, api_key, nil
end
def new_from_token(token)