class Soar::Registry::Identity::Provider::Customer::Uuid
Public Class Methods
@param [Soar::Registry::Identity::Directory] identity_directory @param [Soar::Registry::Identity::Directory] role_directory
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 15 def initialize(identity_directory:, role_directory:) @identity_directory = identity_directory @role_directory = role_directory end
Public Instance Methods
@param [String] identity_uuid @return [Hash{String => String, Number, Hash, Array}] A hash of attributes
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 68 def calculate_all_attributes(identity_uuid) identity = {} role_entries = @role_directory.directory.search(@role_directory.search_index, identity_uuid) roles = {} role_entries.each do |role_entry| identity = calculate_identity(identity_uuid, role_entry['identity_source']) if role_entry.key?('identity_source') roles[role_entry['identity_role']] = role_entry.key?('identity_role_attributes') ? role_entry['identity_role_attributes'] : {} end raise SoarIdm::IdentityError if identity.empty? identity['roles'] = roles return identity end
@param [identifier] identity_uuid @param [String] role @return [Hash{String => String, Number, Hash, Array}] A hash of attributes
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 53 def calculate_attributes(identity_uuid, role) primary_key = { @role_directory.fetch_index[0] => identity_uuid, @role_directory.fetch_index[1] => role } result = @role_directory.directory.fetch(primary_key) attributes = { role => result.key?('identity_role_attributes') ? result['identity_role_attributes'] : {} } return attributes end
@param [String] identity_uuid @return [Array<String,Number>] list of identifiers
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 37 def calculate_identifiers(identity_uuid) indexes = @identity_directory.directory.index #indexes.delete(@identity_directory.directory) identifiers = [] indexes.each { |index| identifiers << identity[index.to_s] } identifiers << identity[@role_directory.fetch_index[0]] return identifiers.reverse end
@param [String] identifier a string that uniquely identifies an identity @return [Array<String>] identifiers
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 107 def calculate_identities(identity_uuid) return [identity_uuid] end
@param [String] identity_uuid @param [String] identity_source @return [Hash{String => String, Number, Hash, Array}] @raise [SoarIdm::IdentityError]
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 87 def calculate_identity(identity_uuid, identity_source) identity_id = get_identity_id(identity_source) if not identity_source.nil? #raise SoarIdm::IdentityError if identity_id.nil? begin source_identity = @identity_directory.directory.fetch(identity_id) identity = {} identity["identity_uuid"] = identity_uuid identity["email"] = source_identity['Notifyemail_Invoice'] if source_identity.key?('Notifyemail_Invoice') identity["firstname"] = source_identity['First_Name'] if source_identity.key?('First_Name') identity["lastname"] = source_identity['Surname'] if source_identity.key?('Surname') return identity rescue Soar::Registry::Directory::Error::NoEntriesFoundError => e raise SoarIdm::IdentityError, e.message end end
@param [String] identity_uuid @return [Array<String>] list of roles
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 24 def calculate_roles(identity_uuid) entries = @role_directory.directory.search(@role_directory.search_index, identity_uuid) roles = [] entries.each do |entry| roles << entry[@role_directory.fetch_index[1]] end return roles end
Private Instance Methods
# File lib/soar/registry/identity/provider/customer/uuid.rb, line 113 def get_identity_id(identity_source) result = identity_source.split(":") return result.last.to_i if result[0] === "mysql" and result[1] === "genie" and result[2] === "client" and result[3] === "id" end