protected function _getServiceProviderUuid($spEntityId, $db) { $statement = $db->prepare("SELECT uuid FROM service_provider_uuid WHERE service_provider_entity_id=?"); $statement->execute(array($spEntityId)); $result = $statement->fetchAll(); if (empty($result)) { $uuid = (string) Surfnet_Zend_Uuid::generate(); $statement = $db->prepare("INSERT INTO service_provider_uuid (uuid, service_provider_entity_id) VALUES (?,?)"); $statement->execute(array($uuid, $spEntityId)); } else { $uuid = $result[0]['uuid']; } return $uuid; }
protected function _getServiceProviderUuid($spEntityId) { $uuid = $this->_fetchServiceProviderUuid($spEntityId); if ($uuid) { return $uuid; } $uuid = (string) Surfnet_Zend_Uuid::generate(); $this->_storeServiceProviderUuid($spEntityId, $uuid); return $uuid; }
protected function _getCollabPersonUuid($attributes) { return (string) Surfnet_Zend_Uuid::generate(); }
* * @var $this DbPatch_Command_Patch_PHP * @var $writer DbPatch_Core_Writer * @var $db Zend_Db_Adapter_Abstract * @var $phpFile string */ $ldapConfig = EngineBlock_ApplicationSingleton::getInstance()->getConfiguration()->ldap; $ldapOptions = array('host' => $ldapConfig->host, 'useSsl' => $ldapConfig->useSsl, 'username' => $ldapConfig->userName, 'password' => $ldapConfig->password, 'bindRequiresDn' => $ldapConfig->bindRequiresDn, 'accountDomainName' => $ldapConfig->accountDomainName, 'baseDn' => $ldapConfig->baseDn); $ldapClient = new Zend_Ldap($ldapOptions); $ldapClient->bind(); $writer->info("Retrieving all collabPerson entries from LDAP"); //$filter = '(&(objectclass=collabPerson))'; $filter = '(&(objectclass=collabPerson)(!(collabPersonUUID=*)))'; $users = $ldapClient->search($filter); while (count($users) > 0) { $writer->info("Retrieved " . count($users) . " users from LDAP"); foreach ($users as $user) { foreach ($user as $userKey => $userValue) { if (is_array($userValue) && count($userValue) === 1) { $user[$userKey] = $userValue[0]; } } $user['collabpersonuuid'] = (string) Surfnet_Zend_Uuid::generate(); $now = date(DATE_RFC822); $user['collabpersonlastupdated'] = $now; $dn = 'uid=' . $user['uid'] . ',o=' . $user['o'] . ',' . $ldapClient->getBaseDn(); $ldapClient->update($dn, $user); $writer->info("Set UUID '{$user['collabpersonuuid']}' for DN: '{$dn}'"); } $users = $ldapClient->search($filter); }