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


PHP PhabricatorUser::getPHID方法代码示例

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


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

示例1: getPasswordHashInput

 private function getPasswordHashInput(PhutilOpaqueEnvelope $password, PhabricatorUser $user)
 {
     if ($user->getPHID() != $this->getUserPHID()) {
         throw new Exception(pht('User does not match password user PHID!'));
     }
     $raw_input = PhabricatorHash::digestPassword($password, $user->getPHID());
     return new PhutilOpaqueEnvelope($raw_input);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:PhabricatorRepositoryVCSPassword.php

示例2: generateTestFile

 private function generateTestFile(PhabricatorUser $actor)
 {
     $engine = new PhabricatorTestStorageEngine();
     $data = Filesystem::readRandomCharacters(64);
     $params = array('name' => 'test.' . $actor->getPHID(), 'viewPolicy' => $actor->getPHID(), 'authorPHID' => $actor->getPHID(), 'storageEngines' => array($engine));
     $file = PhabricatorFile::newFromFileData($data, $params);
     $file->save();
     return $file;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:9,代码来源:ConpherenceTestCase.php

示例3: loadDraftAndPublishedComments

 public static function loadDraftAndPublishedComments(PhabricatorUser $viewer, $commit_phid, $path_id = null)
 {
     if ($path_id === null) {
         $inlines = id(new PhabricatorAuditTransactionComment())->loadAllWhere('commitPHID = %s AND (transactionPHID IS NOT NULL OR authorPHID = %s)
       AND pathID IS NOT NULL', $commit_phid, $viewer->getPHID());
     } else {
         $inlines = id(new PhabricatorAuditTransactionComment())->loadAllWhere('commitPHID = %s AND pathID = %d AND
       (authorPHID = %s OR transactionPHID IS NOT NULL)', $commit_phid, $path_id, $viewer->getPHID());
     }
     return self::buildProxies($inlines);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:11,代码来源:PhabricatorAuditInlineComment.php

示例4: loadStatus

 public function loadStatus(PhabricatorUser $user)
 {
     $revisions = id(new DifferentialRevisionQuery())->withResponsibleUsers(array($user->getPHID()))->withStatus(DifferentialRevisionQuery::STATUS_OPEN)->execute();
     list($active, $waiting) = DifferentialRevisionQuery::splitResponsible($revisions, $user->getPHID());
     $status = array();
     $active = count($active);
     $type = $active ? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION : PhabricatorApplicationStatusView::TYPE_EMPTY;
     $status[] = id(new PhabricatorApplicationStatusView())->setType($type)->setText(pht('%d Review(s) Need Attention', $active))->setCount($active);
     $waiting = count($waiting);
     $type = $waiting ? PhabricatorApplicationStatusView::TYPE_INFO : PhabricatorApplicationStatusView::TYPE_EMPTY;
     $status[] = id(new PhabricatorApplicationStatusView())->setType($type)->setText(pht('%d Review(s) Waiting on Others', $waiting));
     return $status;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:13,代码来源:PhabricatorApplicationDifferential.php

示例5: newFromUserAndKey

 public static function newFromUserAndKey(PhabricatorUser $user, $key)
 {
     if ($user->getPHID() && strlen($key)) {
         $draft = id(new PhabricatorDraft())->loadOneWhere('authorPHID = %s AND draftKey = %s', $user->getPHID(), $key);
         if ($draft) {
             return $draft;
         }
     }
     $draft = new PhabricatorDraft();
     if ($user->getPHID()) {
         $draft->setAuthorPHID($user->getPHID())->setDraftKey($key);
     }
     return $draft;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:14,代码来源:PhabricatorDraft.php

示例6: createUserAccount

 protected function createUserAccount(PhabricatorUser $user)
 {
     $request = $this->getRequest();
     $xactions = array();
     $xactions[] = id(new PhortuneAccountTransaction())->setTransactionType(PhortuneAccountTransaction::TYPE_NAME)->setNewValue(pht('Account (%s)', $user->getUserName()));
     $xactions[] = id(new PhortuneAccountTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', PhabricatorEdgeConfig::TYPE_ACCOUNT_HAS_MEMBER)->setNewValue(array('=' => array($user->getPHID() => $user->getPHID())));
     $account = id(new PhortuneAccount())->attachMemberPHIDs(array());
     $editor = id(new PhortuneAccountEditor())->setActor($user)->setContentSourceFromRequest($request);
     // We create an account for you the first time you visit Phortune.
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $editor->applyTransactions($account, $xactions);
     unset($unguarded);
     return $account;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:14,代码来源:PhortuneController.php

示例7: indexUser

 public static function indexUser(PhabricatorUser $user)
 {
     $doc = new PhabricatorSearchAbstractDocument();
     $doc->setPHID($user->getPHID());
     $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_USER);
     $doc->setDocumentTitle($user->getUserName() . ' (' . $user->getRealName() . ')');
     $doc->setDocumentCreated($user->getDateCreated());
     $doc->setDocumentModified($user->getDateModified());
     // TODO: Index the blurbs from their profile or something? Probably not
     // actually useful...
     if (!$user->getIsDisabled()) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $user->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, time());
     }
     self::reindexAbstractDocument($doc);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:15,代码来源:PhabricatorSearchUserIndexer.php

示例8: hasAutomaticCapability

 public function hasAutomaticCapability($capability, PhabricatorUser $viewer)
 {
     if (!$viewer->getPHID()) {
         return false;
     }
     $object = $this->getIdentityObject();
     if ($object instanceof PhabricatorUser) {
         return $object->getPHID() == $viewer->getPHID();
     } else {
         if ($object instanceof PhabricatorExternalAccount) {
             return $object->getUserPHID() == $viewer->getPHID();
         }
     }
     return false;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:15,代码来源:PhabricatorAuthSession.php

示例9: hasAutomaticCapability

 public function hasAutomaticCapability($capability, PhabricatorUser $viewer)
 {
     $can_edit = PhabricatorPolicyCapability::CAN_EDIT;
     switch ($capability) {
         case PhabricatorPolicyCapability::CAN_VIEW:
             if ($this->isUserMember($viewer->getPHID())) {
                 // Project members can always view a project.
                 return true;
             }
             break;
         case PhabricatorPolicyCapability::CAN_EDIT:
             $parent = $this->getParentProject();
             if ($parent) {
                 $can_edit_parent = PhabricatorPolicyFilter::hasCapability($viewer, $parent, $can_edit);
                 if ($can_edit_parent) {
                     return true;
                 }
             }
             break;
         case PhabricatorPolicyCapability::CAN_JOIN:
             if (PhabricatorPolicyFilter::hasCapability($viewer, $this, $can_edit)) {
                 // Project editors can always join a project.
                 return true;
             }
             break;
     }
     return false;
 }
开发者ID:phpengineer,项目名称:phabricator,代码行数:28,代码来源:PhabricatorProject.php

示例10: createConpherence

 public static function createConpherence(PhabricatorUser $creator, array $participant_phids, $title, $message, PhabricatorContentSource $source)
 {
     $conpherence = id(new ConpherenceThread())->attachParticipants(array())->attachFilePHIDs(array())->setMessageCount(0);
     $files = array();
     $errors = array();
     if (empty($participant_phids)) {
         $errors[] = self::ERROR_EMPTY_PARTICIPANTS;
     } else {
         $participant_phids[] = $creator->getPHID();
         $participant_phids = array_unique($participant_phids);
         $conpherence->setRecentParticipantPHIDs(array_slice($participant_phids, 0, 10));
     }
     if (empty($message)) {
         $errors[] = self::ERROR_EMPTY_MESSAGE;
     }
     $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles($creator, array($message));
     if ($file_phids) {
         $files = id(new PhabricatorFileQuery())->setViewer($creator)->withPHIDs($file_phids)->execute();
     }
     if (!$errors) {
         $xactions = array();
         $xactions[] = id(new ConpherenceTransaction())->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)->setNewValue(array('+' => $participant_phids));
         if ($files) {
             $xactions[] = id(new ConpherenceTransaction())->setTransactionType(ConpherenceTransactionType::TYPE_FILES)->setNewValue(array('+' => mpull($files, 'getPHID')));
         }
         if ($title) {
             $xactions[] = id(new ConpherenceTransaction())->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)->setNewValue($title);
         }
         $xactions[] = id(new ConpherenceTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new ConpherenceTransactionComment())->setContent($message)->setConpherencePHID($conpherence->getPHID()));
         id(new ConpherenceEditor())->setContentSource($source)->setContinueOnNoEffect(true)->setActor($creator)->applyTransactions($conpherence, $xactions);
     }
     return array($errors, $conpherence);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:33,代码来源:ConpherenceEditor.php

示例11: applyLeaveProject

 public static function applyLeaveProject(PhabricatorProject $project, PhabricatorUser $user)
 {
     $members = array_fill_keys($project->getMemberPHIDs(), true);
     unset($members[$user->getPHID()]);
     $members = array_keys($members);
     self::applyOneTransaction($project, $user, PhabricatorProjectTransactionType::TYPE_MEMBERS, $members);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:7,代码来源:PhabricatorProjectEditor.php

示例12: buildIconNavView

 public function buildIconNavView(PhabricatorUser $user)
 {
     $viewer = $this->getViewer();
     $picture = $user->getProfileImageURI();
     $name = $user->getUsername();
     $nav = new AphrontSideNavFilterView();
     $nav->setIconNav(true);
     $nav->setBaseURI(new PhutilURI('/p/'));
     $nav->addIcon("{$name}/", $name, null, $picture);
     $class = 'PhabricatorCalendarApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $nav->addIcon("{$name}/calendar/", pht('Calendar'), 'fa-calendar');
     }
     $class = 'PhabricatorManiphestApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $phid = $user->getPHID();
         $view_uri = sprintf('/maniphest/?statuses=open()&assigned=%s#R', $phid);
         $nav->addIcon('maniphest', pht('Open Tasks'), 'fa-anchor', null, $view_uri);
     }
     $class = 'PhabricatorDifferentialApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $username = phutil_escape_uri($name);
         $view_uri = '/differential/?authors=' . $username;
         $nav->addIcon('differential', pht('Revisions'), 'fa-cog', null, $view_uri);
     }
     $class = 'PhabricatorAuditApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $username = phutil_escape_uri($name);
         $view_uri = '/audit/?authors=' . $username;
         $nav->addIcon('audit', pht('Commits'), 'fa-code', null, $view_uri);
     }
     return $nav;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:33,代码来源:PhabricatorPeopleController.php

示例13: buildUserInformationDictionary

 protected function buildUserInformationDictionary(PhabricatorUser $user, PhabricatorUserStatus $current_status = null)
 {
     $roles = array();
     if ($user->getIsDisabled()) {
         $roles[] = 'disabled';
     }
     if ($user->getIsSystemAgent()) {
         $roles[] = 'agent';
     }
     if ($user->getIsAdmin()) {
         $roles[] = 'admin';
     }
     $primary = $user->loadPrimaryEmail();
     if ($primary && $primary->getIsVerified()) {
         $roles[] = 'verified';
     } else {
         $roles[] = 'unverified';
     }
     $return = array('phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'image' => $user->loadProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/' . $user->getUsername() . '/'), 'roles' => $roles);
     if ($current_status) {
         $return['currentStatus'] = $current_status->getTextStatus();
         $return['currentStatusUntil'] = $current_status->getDateTo();
     }
     return $return;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:25,代码来源:ConduitAPI_user_Method.php

示例14: loadNeedAttentionRevisions

 public static function loadNeedAttentionRevisions(PhabricatorUser $viewer)
 {
     if (!$viewer->isLoggedIn()) {
         return array();
     }
     $viewer_phid = $viewer->getPHID();
     $responsible_phids = id(new DifferentialResponsibleDatasource())->setViewer($viewer)->evaluateTokens(array($viewer_phid));
     $revision_query = id(new DifferentialRevisionQuery())->setViewer($viewer)->withStatus(DifferentialRevisionQuery::STATUS_OPEN)->withResponsibleUsers($responsible_phids)->needReviewerStatus(true)->needRelationships(true)->needFlags(true)->needDrafts(true)->setLimit(self::MAX_STATUS_ITEMS);
     $revisions = $revision_query->execute();
     $query = id(new PhabricatorSavedQuery())->attachParameterMap(array('responsiblePHIDs' => $responsible_phids));
     $groups = id(new DifferentialRevisionRequiredActionResultBucket())->setViewer($viewer)->newResultGroups($query, $revisions);
     $include = array();
     foreach ($groups as $group) {
         switch ($group->getKey()) {
             case DifferentialRevisionRequiredActionResultBucket::KEY_MUSTREVIEW:
             case DifferentialRevisionRequiredActionResultBucket::KEY_SHOULDREVIEW:
                 foreach ($group->getObjects() as $object) {
                     $include[] = $object;
                 }
                 break;
             default:
                 break;
         }
     }
     return $include;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:26,代码来源:PhabricatorDifferentialApplication.php

示例15: hasAutomaticCapability

 public function hasAutomaticCapability($capability, PhabricatorUser $viewer)
 {
     if ($viewer->getPHID() == $this->userPHID) {
         return true;
     }
     return false;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorNamedQuery.php


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