private function nextUser() { $this->adminKuser = adminKuserPeer::retrieveByPK($this->curId); $this->assertNotNull($this->adminKuser, 'Admin kuser not found with id [' . $this->curId . ']'); $cLoginData = new Criteria(); $cLoginData->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $this->adminKuser->getEmail()); $loginDatas = UserLoginDataPeer::doSelect($cLoginData); $this->assertEquals(1, count($loginDatas), 'Number of login datas found for id [' . $this->curId . ']'); $this->loginData = $loginDatas[0]; $cKuser = new Criteria(); $cKuser->addAnd(kuserPeer::LOGIN_DATA_ID, $this->loginData->getId()); $cKuser->addAnd(kuserPeer::PARTNER_ID, $this->adminKuser->getPartnerId()); $kusers = kuserPeer::doSelect($cKuser); $this->assertEquals(1, count($kusers), 'Number of kusers found for id [' . $this->curId . ']'); $this->kuser = $kusers[0]; return true; }
public function isPassHashKeyValid($hashKey) { // check if same as user's saved hash key if (base64_decode($hashKey) != base64_decode($this->getPasswordHashKey())) { throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_INVALID); } // decode $params = adminKuserPeer::decodePassHashKey($hashKey); if (!$params) { throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_INVALID); } // check if admin_kuser id is right if ($params[0] != $this->getId()) { throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_INVALID); } // check if not expired if ($params[1] < time()) { throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_EXPIRED); } return true; }
function getUsers($lastUser, $userLimitEachLoop) { adminKuserPeer::clearInstancePool(); $c = new Criteria(); $c->add(adminKuserPeer::ID, $lastUser, Criteria::GREATER_THAN); $c->addAscendingOrderByColumn(adminKuserPeer::ID); $c->setLimit($userLimitEachLoop); adminKuserPeer::setUseCriteriaFilter(false); $users = adminKuserPeer::doSelect($c); adminKuserPeer::setUseCriteriaFilter(true); return $users; }
/** * @param string $email * @param string $use_bd * @return adminKuser */ public static function getAdminKuserByEmail($email) { $c = new Criteria(); $c->add(adminKuserPeer::EMAIL, $email); $admin = adminKuserPeer::doSelectOne($c); return $admin; }
/** * Returns the number of related adminKuser objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related adminKuser objects. * @throws PropelException */ public function countadminKusers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PartnerPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->colladminKusers === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(adminKuserPeer::PARTNER_ID, $this->id); $count = adminKuserPeer::doCount($criteria, false, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return count of the collection. $criteria->add(adminKuserPeer::PARTNER_ID, $this->id); if (!isset($this->lastadminKuserCriteria) || !$this->lastadminKuserCriteria->equals($criteria)) { $count = adminKuserPeer::doCount($criteria, false, $con); } else { $count = count($this->colladminKusers); } } else { $count = count($this->colladminKusers); } } return $count; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = adminKuserPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setScreenName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setFullName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setEmail($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setSha1Password($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setSalt($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setPicture($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setIcon($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setCreatedAt($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setUpdatedAt($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setPartnerId($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setLoginBlockedUntil($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setCustomData($arr[$keys[12]]); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(adminKuserPeer::DATABASE_NAME); $criteria->add(adminKuserPeer::ID, $pks, Criteria::IN); $objs = adminKuserPeer::doSelect($criteria, $con); } return $objs; }
/** * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless * of whether or not they have been modified. * * @return Criteria The Criteria object containing value(s) for primary key(s). */ public function buildPkeyCriteria() { $criteria = new Criteria(adminKuserPeer::DATABASE_NAME); $criteria->add(adminKuserPeer::ID, $this->id); if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(adminKuserPeer::UPDATED_AT)) { $theModifiedColumn = null; foreach ($this->modifiedColumns as $modifiedColumn) { if ($modifiedColumn != adminKuserPeer::UPDATED_AT) { $theModifiedColumn = $modifiedColumn; } } $atomicColumns = adminKuserPeer::getAtomicColumns(); if (in_array($theModifiedColumn, $atomicColumns)) { $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL); } } return $criteria; }
if ($user->getPartnerId() == PartnerPeer::GLOBAL_PARTNER) { KalturaLog::log('Skipping partner 0'); continue; } list($firstName, $lastName) = kString::nameSplit($user->getFullName()); $user->setFirstName($firstName); $user->setLastName($lastName); if ($user->getIsAdmin() !== true) { $user->setIsAdmin(false); } $new_login_data = null; if ($user->getSalt() && $user->getSha1Password() && in_array($user->getPartnerId(), $loginPartnerIds)) { $newTempEmail = $user->getEmail(); $c = new Criteria(); $c->addAnd(adminKuserPeer::EMAIL, $newTempEmail, Criteria::EQUAL); $adminKuser = adminKuserPeer::doSelectOne($c); if ($adminKuser) { if ($user->getPartnerId() === $adminKuser->getPartnerId() && $user->getPuserId() === '__ADMIN__' . $adminKuser->getId()) { continue; } $newTempEmail = 'kuser_' . $user->getId() . '_' . $user->getEmail(); $msg = 'NOTICE - kuser [' . $lastUser . '] of partner [' . $user->getPartnerId() . '] is set with email [' . $user->getEmail() . '] already used by admin_kuser id [' . $adminKuser->getId() . '] of partner [' . $adminKuser->getPartnerId() . '] - setting kusers login email to [' . $newTempEmail . ']!'; KalturaLog::notice($msg); } if (!kString::isEmailString($user->getEmail())) { $newTempEmail = 'kuser_' . $user->getId() . '_' . $user->getEmail(); $msg = 'NOTICE - kuser [' . $lastUser . '] of partner [' . $user->getPartnerId() . '] is set with invalid email [' . $user->getEmail() . '] - setting kusers login email to [' . $newTempEmail . ']!'; KalturaLog::notice($msg); } // user can login - add a user_login_data record $existingLoginData = UserLoginDataPeer::getByEmail($newTempEmail);