本文整理汇总了PHP中PFUser::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::setStatus方法的具体用法?PHP PFUser::setStatus怎么用?PHP PFUser::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::setStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUsers
public function generateUsers()
{
$user_1 = new PFUser();
$user_1->setUserName(self::TEST_USER_1_NAME);
$user_1->setRealName(self::TEST_USER_1_REALNAME);
$user_1->setLdapId(self::TEST_USER_1_LDAPID);
$user_1->setPassword(self::TEST_USER_1_PASS);
$user_1->setStatus(self::TEST_USER_1_STATUS);
$user_1->setEmail(self::TEST_USER_1_EMAIL);
$user_1->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_1);
$user_1->setLabFeatures(true);
return $this;
}
示例2: deleteSuspendedUser
/**
* Delete suspended user
*
* @param PFUser user
*
*/
private function deleteSuspendedUser(PFUser $user)
{
if ($user->getStatus() == 'S') {
$user->setStatus('D');
$deletionResult = $this->getUserManager()->updateDb($user);
if (!$deletionResult) {
$this->getBackendLogger()->error("[LDAP Clean Up] Error when deleting user " . $user->getUserName());
} else {
$directoryCleanUpDao = $this->getLDAPDirectoryCleanUpDao();
$resetResult = $directoryCleanUpDao->resetForecastDeletionDate($user->getId());
if (!$resetResult) {
$this->getBackendLogger()->warn("[LDAP Clean Up] Unable to reset forecast deletion date for user " . $user->getUserName());
}
$this->removeUserFromProjects($user);
$this->getBackendLogger()->info("[LDAP Clean Up] user " . $user->getUserName() . " have been deleted");
}
}
}
示例3: generateUsers
public function generateUsers()
{
$user_1 = new PFUser();
$user_1->setUserName(self::TEST_USER_1_NAME);
$user_1->setRealName(self::TEST_USER_1_REALNAME);
$user_1->setLdapId(self::TEST_USER_1_LDAPID);
$user_1->setPassword(self::TEST_USER_1_PASS);
$user_1->setStatus(self::TEST_USER_1_STATUS);
$user_1->setEmail(self::TEST_USER_1_EMAIL);
$user_1->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_1);
$user_1->setLabFeatures(true);
$user_2 = new PFUser();
$user_2->setUserName(self::TEST_USER_2_NAME);
$user_2->setPassword(self::TEST_USER_2_PASS);
$user_2->setStatus(self::TEST_USER_2_STATUS);
$user_2->setEmail(self::TEST_USER_2_EMAIL);
$user_2->setLanguage($GLOBALS['Language']);
$user_2->setAuthorizedKeys('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHk9 toto@marche');
$this->user_manager->createAccount($user_2);
$user_3 = new PFUser();
$user_3->setUserName(self::TEST_USER_3_NAME);
$user_3->setPassword(self::TEST_USER_3_PASS);
$user_3->setStatus(self::TEST_USER_3_STATUS);
$user_3->setEmail(self::TEST_USER_3_EMAIL);
$user_3->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_3);
$user_4 = new PFUser();
$user_4->setUserName(self::TEST_USER_4_NAME);
$user_4->setPassword(self::TEST_USER_4_PASS);
$user_4->setStatus(self::TEST_USER_4_STATUS);
$user_4->setEmail(self::TEST_USER_1_EMAIL);
$user_4->setLanguage($GLOBALS['Language']);
$this->user_manager->createAccount($user_4);
return $this;
}
示例4: createAccount
/**
* Create user account based on LDAP info.
*
* @param String $eduid
* @param String $uid
* @param String $cn
* @param String $email
* @return PFUser
*/
function createAccount($eduid, $uid, $cn, $email)
{
if (trim($uid) == '' || trim($eduid) == '') {
return false;
}
$user = new PFUser();
$user->setUserName($this->generateLogin($uid));
$user->setLdapId($eduid);
$user->setRealName($cn);
$user->setEmail($email);
// Generates a pseudo-random password. Its not full secure but its
// better than nothing.
$user->setPassword(md5((string) mt_rand(10000, 999999) . time()));
// Default LDAP
$user->setStatus($this->getLdap()->getLDAPParam('default_user_status'));
$user->setRegisterPurpose('LDAP');
$user->setUnixStatus('S');
$user->setTimezone('GMT');
$user->setLanguageID($GLOBALS['Language']->getText('conf', 'language_id'));
$um = $this->getUserManager();
$u = $um->createAccount($user);
if ($u) {
$u = $um->getUserById($user->getId());
// Create an entry in the ldap user db
$ldapUserDao = $this->getDao();
$ldapUserDao->createLdapUser($u->getId(), 0, $uid);
return $u;
}
return false;
}
示例5: createAccount
/**
* Create user account based on LDAP info.
*
* @param String $eduid
* @param String $uid
* @param String $cn
* @param String $email
* @return PFUser
*/
function createAccount($eduid, $uid, $cn, $email)
{
if (trim($uid) == '' || trim($eduid) == '') {
return false;
}
$user = new PFUser();
$user->setUserName($this->generateLogin($uid));
$user->setLdapId($eduid);
$user->setRealName($cn);
$user->setEmail($email);
$mail_confirm_code_generator = new MailConfirmationCodeGenerator($this->getUserManager(), new RandomNumberGenerator());
$mail_confirm_code = $mail_confirm_code_generator->getConfirmationCode();
$user->setConfirmHash($mail_confirm_code);
// Default LDAP
$user->setStatus($this->getLdap()->getLDAPParam('default_user_status'));
$user->setRegisterPurpose('LDAP');
$user->setUnixStatus('S');
$user->setTimezone('GMT');
$user->setLanguageID($GLOBALS['Language']->getText('conf', 'language_id'));
$um = $this->getUserManager();
$u = $um->createAccount($user);
if ($u) {
$u = $um->getUserById($user->getId());
// Create an entry in the ldap user db
$ldapUserDao = $this->getDao();
$ldapUserDao->createLdapUser($u->getId(), 0, $uid);
return $u;
}
return false;
}
示例6: itDoesNotSendAnEmailToAdministratorIfUserIsActive
public function itDoesNotSendAnEmailToAdministratorIfUserIsActive() {
stub($this->dao)->create()->returns(101);
$this->user->setStatus(PFUser::STATUS_ACTIVE);
expect($this->pending_user_notifier)->notifyAdministrator()->never();
$this->manager->createAccount($this->user);
}
示例7: account_create
function account_create($loginname = '', $pw = '', $ldap_id = '', $realname = '', $register_purpose = '', $email = '', $status = 'P', $confirm_hash = '', $mail_site = 0, $mail_va = 0, $timezone = 'GMT', $lang_id = 'en_US', $unix_status = 'N', $expiry_date = 0)
{
$um = UserManager::instance();
$user = new PFUser();
$user->setUserName($loginname);
$user->setRealName($realname);
$user->setPassword($pw);
$user->setLdapId($ldap_id);
$user->setRegisterPurpose($register_purpose);
$user->setEmail($email);
$user->setStatus($status);
$user->setConfirmHash($confirm_hash);
$user->setMailSiteUpdates($mail_site);
$user->setMailVA($mail_va);
$user->setTimezone($timezone);
$user->setLanguageID($lang_id);
$user->setUnixStatus($unix_status);
$user->setExpiryDate($expiry_date);
$u = $um->createAccount($user);
if ($u) {
return $u->getId();
} else {
return $u;
}
}