本文整理汇总了PHP中PhabricatorUser::getIsApproved方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::getIsApproved方法的具体用法?PHP PhabricatorUser::getIsApproved怎么用?PHP PhabricatorUser::getIsApproved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorUser
的用法示例。
在下文中一共展示了PhabricatorUser::getIsApproved方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildUserInformationDictionary
protected function buildUserInformationDictionary(PhabricatorUser $user, $with_email = false, $with_availability = false)
{
$roles = array();
if ($user->getIsDisabled()) {
$roles[] = 'disabled';
}
if ($user->getIsSystemAgent()) {
$roles[] = 'agent';
}
if ($user->getIsMailingList()) {
$roles[] = 'list';
}
if ($user->getIsAdmin()) {
$roles[] = 'admin';
}
$primary = $user->loadPrimaryEmail();
if ($primary && $primary->getIsVerified()) {
$email = $primary->getAddress();
$roles[] = 'verified';
} else {
$email = null;
$roles[] = 'unverified';
}
if ($user->getIsApproved()) {
$roles[] = 'approved';
}
if ($user->isUserActivated()) {
$roles[] = 'activated';
}
$return = array('phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'image' => $user->getProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/' . $user->getUsername() . '/'), 'roles' => $roles);
if ($with_email) {
$return['primaryEmail'] = $email;
}
if ($with_availability) {
// TODO: Modernize this once we have a more long-term view of what the
// data looks like.
$until = $user->getAwayUntil();
if ($until) {
$return['currentStatus'] = 'away';
$return['currentStatusUntil'] = $until;
}
}
return $return;
}
示例2: validateSender
public function validateSender(PhabricatorMetaMTAReceivedMail $mail, PhabricatorUser $sender)
{
$failure_reason = null;
if ($sender->getIsDisabled()) {
$failure_reason = pht('Your account (%s) is disabled, so you can not interact with ' . 'Phabricator over email.', $sender->getUsername());
} else {
if ($sender->getIsStandardUser()) {
if (!$sender->getIsApproved()) {
$failure_reason = pht('Your account (%s) has not been approved yet. You can not interact ' . 'with Phabricator over email until your account is approved.', $sender->getUsername());
} else {
if (PhabricatorUserEmail::isEmailVerificationRequired() && !$sender->getIsEmailVerified()) {
$failure_reason = pht('You have not verified the email address for your account (%s). ' . 'You must verify your email address before you can interact ' . 'with Phabricator over email.', $sender->getUsername());
}
}
}
}
if ($failure_reason) {
throw new PhabricatorMetaMTAReceivedMailProcessingException(MetaMTAReceivedMailStatus::STATUS_DISABLED_SENDER, $failure_reason);
}
}
示例3: approveUser
/**
* @task role
*/
public function approveUser(PhabricatorUser $user, $approve)
{
$actor = $this->requireActor();
if (!$user->getID()) {
throw new Exception('User has not been created yet!');
}
$user->openTransaction();
$user->beginWriteLocking();
$user->reload();
if ($user->getIsApproved() == $approve) {
$user->endWriteLocking();
$user->killTransaction();
return $this;
}
$log = PhabricatorUserLog::initializeNewLog($actor, $user->getPHID(), PhabricatorUserLog::ACTION_APPROVE);
$log->setOldValue($user->getIsApproved());
$log->setNewValue($approve);
$user->setIsApproved($approve);
$user->save();
$log->save();
$user->endWriteLocking();
$user->saveTransaction();
return $this;
}