当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorUser::getSession方法代码示例

本文整理汇总了PHP中PhabricatorUser::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::getSession方法的具体用法?PHP PhabricatorUser::getSession怎么用?PHP PhabricatorUser::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorUser的用法示例。


在下文中一共展示了PhabricatorUser::getSession方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initializeNewLog

 public static function initializeNewLog(PhabricatorUser $actor = null, $object_phid = null, $action = null)
 {
     $log = new PhabricatorUserLog();
     if ($actor) {
         $log->setActorPHID($actor->getPHID());
         if ($actor->hasSession()) {
             $session = $actor->getSession();
             // NOTE: This is a hash of the real session value, so it's safe to
             // store it directly in the logs.
             $log->setSession($session->getSessionKey());
         }
     }
     $log->setUserPHID((string) $object_phid);
     $log->setAction($action);
     $log->remoteAddr = (string) idx($_SERVER, 'REMOTE_ADDR', '');
     return $log;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:17,代码来源:PhabricatorUserLog.php

示例2: isExtensionEnabledForViewer

 public function isExtensionEnabledForViewer(PhabricatorUser $viewer)
 {
     if (!$viewer->isLoggedIn()) {
         return false;
     }
     if (!$viewer->isUserActivated()) {
         return false;
     }
     // Don't show menus for users with partial sessions. This usually means
     // they have logged in but have not made it through MFA, so we don't want
     // to show notification counts, saved queries, etc.
     if (!$viewer->hasSession()) {
         return false;
     }
     if ($viewer->getSession()->getIsPartial()) {
         return false;
     }
     return true;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:19,代码来源:PhabricatorMainMenuBarExtension.php

示例3: signLegalpadDocuments

 /**
  * Upgrade a session to have all legalpad documents signed.
  *
  * @param PhabricatorUser User whose session should upgrade.
  * @param array LegalpadDocument objects
  * @return void
  * @task partial
  */
 public function signLegalpadDocuments(PhabricatorUser $viewer, array $docs)
 {
     if (!$viewer->hasSession()) {
         throw new Exception(pht('Signing session legalpad documents of user with no session!'));
     }
     $session = $viewer->getSession();
     if ($session->getSignedLegalpadDocuments()) {
         throw new Exception(pht('Session has already signed required legalpad documents!'));
     }
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $session->setSignedLegalpadDocuments(1);
     queryfx($session->establishConnection('w'), 'UPDATE %T SET signedLegalpadDocuments = %d WHERE id = %d', $session->getTableName(), 1, $session->getID());
     if (!empty($docs)) {
         $log = PhabricatorUserLog::initializeNewLog($viewer, $viewer->getPHID(), PhabricatorUserLog::ACTION_LOGIN_LEGALPAD);
         $log->save();
     }
     unset($unguarded);
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:26,代码来源:PhabricatorAuthSessionEngine.php

示例4: upgradePartialSession

 /**
  * Upgrade a partial session to a full session.
  *
  * @param PhabricatorAuthSession Session to upgrade.
  * @return void
  * @task partial
  */
 public function upgradePartialSession(PhabricatorUser $viewer)
 {
     if (!$viewer->hasSession()) {
         throw new Exception(pht('Upgrading partial session of user with no session!'));
     }
     $session = $viewer->getSession();
     if (!$session->getIsPartial()) {
         throw new Exception(pht('Session is not partial!'));
     }
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $session->setIsPartial(0);
     queryfx($session->establishConnection('w'), 'UPDATE %T SET isPartial = %d WHERE id = %d', $session->getTableName(), 0, $session->getID());
     $log = PhabricatorUserLog::initializeNewLog($viewer, $viewer->getPHID(), PhabricatorUserLog::ACTION_LOGIN_FULL);
     $log->save();
     unset($unguarded);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:23,代码来源:PhabricatorAuthSessionEngine.php


注:本文中的PhabricatorUser::getSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。