本文整理汇总了PHP中PFUser::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::getStatus方法的具体用法?PHP PFUser::getStatus怎么用?PHP PFUser::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::getStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processReminder
/**
* Process admin notification while traversing the list of project the suspended user belong to.
*
* @param PFUser $user Suspended user after LDAP daily synchro.
*
* @return void
*/
public function processReminder(PFUser $user)
{
$to = '';
if ($user->getStatus() == 'S') {
$adminsEmails = $this->ldapSyncMail->getNotificationRecipients($user);
foreach ($adminsEmails as $projectName => $emailList) {
$subject = $this->getSubject($projectName, $user);
$body = $this->getBody($projectName, $user);
$to = implode(";", $emailList);
$this->ldapSyncMail->notifyProjectsAdmins($to, $projectName, $user, $subject, $body);
}
}
}
示例2: isFinalStatus
/**
* Check user status validity
*
* @param PFUser $user
* @param Boolean $allowpending
* @return Boolean
* @throws User_StatusDeletedException
* @throws User_StatusSuspendedException
*/
private function isFinalStatus(PFUser $user)
{
$status = $user->getStatus();
switch ($status) {
case PFUser::STATUS_ACTIVE:
case PFUser::STATUS_RESTRICTED:
return true;
break;
case PFUser::STATUS_DELETED:
throw new User_StatusDeletedException();
case PFUser::STATUS_SUSPENDED:
throw new User_StatusSuspendedException();
default:
return false;
}
}
示例3: 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");
}
}
}
示例4: hasAllowedStatus
private function hasAllowedStatus(PFUser $user)
{
return in_array($user->getStatus(), $this->allowed_status);
}
示例5: ldap_daily_synchro_update_user
/**
* @param PFUser user
*/
public function ldap_daily_synchro_update_user(PFUser $user)
{
if ($user->getStatus() == PFUser::STATUS_SUSPENDED) {
$factory = $this->getGerritServerFactory();
$gerrit_servers = $factory->getServers();
$gerritDriverFactory = new Git_Driver_Gerrit_GerritDriverFactory($this->getLogger());
foreach ($gerrit_servers as $server) {
$gerritDriver = $gerritDriverFactory->getDriver($server);
$gerritDriver->setUserAccountInactive($server, $user);
}
}
}
示例6: createAccount
/**
* Create new account
*
* @param PFUser $user
*
* @return PFUser
*/
function createAccount($user)
{
$dao = $this->getDao();
$user_id = $dao->create($user->getUserName(), $user->getEmail(), $user->getPassword(), $user->getRealName(), $user->getRegisterPurpose(), $user->getStatus(), $user->getShell(), $user->getUnixStatus(), $user->getUnixUid(), $user->getUnixBox(), $user->getLdapId(), $_SERVER['REQUEST_TIME'], $user->getConfirmHash(), $user->getMailSiteUpdates(), $user->getMailVA(), $user->getStickyLogin(), $user->getAuthorizedKeys(), $user->getNewMail(), $user->getTimeZone(), $user->getTheme(), $user->getLanguageID(), $user->getExpiryDate(), $_SERVER['REQUEST_TIME']);
if (!$user_id) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('include_exit', 'error'));
return 0;
} else {
$user->setId($user_id);
$this->assignNextUnixUid($user);
$em = $this->_getEventManager();
$em->processEvent(Event::USER_MANAGER_CREATE_ACCOUNT, array('user' => $user));
// Create the first layout for the user and add some initial widgets
$lm = $this->_getWidgetLayoutManager();
$lm->createDefaultLayoutForUser($user_id);
switch ($user->getStatus()) {
case PFUser::STATUS_PENDING:
if (ForgeConfig::get('sys_user_approval')) {
$this->pending_user_notifier->notifyAdministrator($user);
}
break;
case PFUser::STATUS_ACTIVE:
case PFUser::STATUS_RESTRICTED:
$em->processEvent('project_admin_activate_user', array('user_id' => $user_id));
break;
}
return $user;
}
}
示例7: isValidUser
/**
* @return bool true if the user is considered valid (active or restricted)
*/
private function isValidUser(PFUser $user)
{
return isset(self::$user_status[$user->getStatus()]);
}