コード例 #1
0
 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;
 }
コード例 #2
0
 protected function _getCollabPersonUuid($attributes)
 {
     return (string) Surfnet_Zend_Uuid::generate();
 }
コード例 #3
0
 /**
  * Look for a system-provided source of randomness, which is usually crytographically secure.
  * /dev/urandom is tried first simply out of bias for Linux systems.
  */
 public static function initRandom()
 {
     if (is_readable('/dev/urandom')) {
         self::$randomSource = fopen('/dev/urandom', 'rb');
         self::$randomFunc = 'randomFRead';
     } else {
         if (class_exists('COM', 0)) {
             try {
                 self::$randomSource = new COM('CAPICOM.Utilities.1');
                 // See http://msdn.microsoft.com/en-us/library/aa388182(VS.85).aspx
                 self::$randomFunc = 'randomCOM';
             } catch (Exception $e) {
             }
         }
     }
     return self::$randomFunc;
 }
コード例 #4
0
 protected function _getServiceProviderUuid($spEntityId)
 {
     $uuid = $this->_fetchServiceProviderUuid($spEntityId);
     if ($uuid) {
         return $uuid;
     }
     $uuid = (string) Surfnet_Zend_Uuid::generate();
     $this->_storeServiceProviderUuid($spEntityId, $uuid);
     return $uuid;
 }
コード例 #5
0
 *
 * @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);
}