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


PHP UserManager::getUserById方法代码示例

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


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

示例1: checkToken

 /**
  * @param Rest_Token $token
  * @return PFUser or null if the user is not found
  * @throws Rest_Exception_InvalidTokenException
  */
 public function checkToken(Rest_Token $token)
 {
     if ($this->token_factory->doesTokenExist($token->getUserId(), $token->getTokenValue())) {
         return $this->user_manager->getUserById($token->getUserId());
     }
     throw new Rest_Exception_InvalidTokenException();
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:TokenManager.class.php

示例2: getUserFromParameters

 private function getUserFromParameters()
 {
     $user = $this->user_manager->getUserById($this->getUserIdFromParameters());
     if ($user == null) {
         throw new UserNotExistException();
     }
     return $user;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:SystemEvent_GIT_EDIT_SSH_KEYS.class.php

示例3: updateWithUserId

 public function updateWithUserId($user_id)
 {
     $user = $this->user_manager->getUserById($user_id);
     if ($user && $user->isAlive()) {
         $this->updateWithUser($user);
     } else {
         $this->logger->warn('Do not write LDAP info about non existant or suspended users ' . $user_id);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:LDAP_UserWrite.class.php

示例4: fetch

 /**
  *
  * @param int $group_id
  * @return GenericUser|null
  */
 public function fetch($group_id)
 {
     if ($row = $this->dao->fetch($group_id)->getRow()) {
         $pfuser = $this->user_manager->getUserById($row['user_id']);
         $generic_user = $this->generateGenericUser($group_id, $pfuser);
         return $generic_user;
     }
     return null;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:GenericUserFactory.class.php

示例5: getAssignees

 /**
  * Retrieve users who are assigned to a given artifact
  *
  * @param Tracker_Artifact $artifact
  * @return PFUser[]
  */
 public function getAssignees(Tracker_Artifact $artifact)
 {
     $user_collection = array();
     foreach ($this->getAssigneeIds($artifact) as $user_id) {
         $user = $this->user_manager->getUserById($user_id);
         if ($user) {
             $user_collection[$user_id] = $user;
         }
     }
     return $user_collection;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:17,代码来源:PermissionRetrieveAssignee.class.php

示例6: buildFieldDataForREST

 /**
  * Get the field data for artifact submission
  * @throws Tracker_Artifact_Attachment_FileNotFoundException
  * @throws Tracker_Artifact_Attachment_AlreadyLinkedToAnotherArtifactException
  */
 public function buildFieldDataForREST($rest_value, Tracker_Artifact $artifact = null)
 {
     $field_data = array();
     $already_attached_file_ids = array();
     if ($artifact) {
         $already_attached_file_ids = $this->getAlreadyAttachedFileIds($artifact);
     }
     $given_rest_file_ids = $rest_value->value;
     // Ids given in REST
     foreach ($given_rest_file_ids as $file_id) {
         $linked_artifact = $this->file_info_factory->getArtifactByFileInfoIdInLastChangeset($file_id);
         // Temporary => link
         if (!$linked_artifact && $this->isFileIdTemporary($file_id)) {
             $temporary_file = $this->getFile($file_id);
             $user = $this->user_manager->getUserById($temporary_file->getCreatorId());
             if (!$this->exists($user, $temporary_file->getTemporaryName())) {
                 throw new Tracker_Artifact_Attachment_FileNotFoundException('Temporary file #' . $file_id . ' not found');
             }
             $field_data[] = $this->file_info_factory->buildFileInfoData($temporary_file, $this->getPath($user, $temporary_file->getTemporaryName()));
         } elseif (!$linked_artifact && !$this->isFileIdTemporary($file_id)) {
             throw new Tracker_Artifact_Attachment_FileNotFoundException('Temporary file #' . $file_id . ' not found');
             // Already attached to another artifact => error
         } elseif ($artifact && $artifact->getId() != $linked_artifact->getId() || !$artifact && $linked_artifact) {
             throw new Tracker_Artifact_Attachment_AlreadyLinkedToAnotherArtifactException('File #' . $file_id . ' is already linked to artifact #' . $linked_artifact->getId());
         }
     }
     // Already attached file ids
     foreach ($already_attached_file_ids as $file_id) {
         // Not in given ids => unlink
         if (!in_array($file_id, $given_rest_file_ids)) {
             $field_data['delete'][] = $file_id;
         }
     }
     return $field_data;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:40,代码来源:TemporaryFileManager.class.php

示例7: Premium

/**
 * Fonction faisant devenir premium le membre connecté.
 */
function Premium()
{
    $udm = new User_DroitManager(connexionDb());
    $udm->modifDroit($_SESSION['User']->getId(), 3);
    $um = new UserManager(connexionDb());
    $user = $um->getUserById($_SESSION['User']->getId());
    $_SESSION['User'] = $user;
}
开发者ID:OvynFlavian,项目名称:IntegrationTP_Groupe_1,代码行数:11,代码来源:devenirPremium.lib.php

示例8: getUser

 private function getUser($user_id)
 {
     $user = $this->user_manager->getUserById($user_id);
     if (!$user) {
         throw new Tracker_Artifact_MailGateway_RecipientUserDoesNotExistException();
     }
     return $user;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:8,代码来源:RecipientFactory.class.php

示例9: getAdditionnalValue

 /**
  * Return the addtionnal value
  *
  * @return Tracker_FormElement_Field_List_Bind_UsersValue
  */
 protected function getAdditionnalValue($value_id)
 {
     if (!isset($this->additionnal_values[$value_id])) {
         $this->additionnal_values[$value_id] = null;
         if ($user = $this->userManager->getUserById($value_id)) {
             $this->additionnal_values[$value_id] = new Tracker_FormElement_Field_List_Bind_UsersValue($user->getId());
         }
     }
     return $this->additionnal_values[$value_id];
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:15,代码来源:Tracker_FormElement_Field_List_Bind_Users.class.php

示例10: membreExistant

/**
 * Fonction servant à vérifier l'existence d'un membre à l'aide de l'ID contenu dans l'url.
 * @return bool : true si il existe, false si il n'existe pas.
 */
function membreExistant()
{
    $id = $_GET['membre'];
    $um = new UserManager(connexionDb());
    $user = $um->getUserById($id);
    if ($user->getUserName() == NULL) {
        return false;
    } else {
        return true;
    }
}
开发者ID:OvynFlavian,项目名称:IntegrationTP_Groupe_1,代码行数:15,代码来源:Fonctions.php

示例11: getFriendByFid

 public static function getFriendByFid($_fid)
 {
     $arr = array();
     require "opendb.php";
     require "history.php";
     require "account.php";
     require "user.php";
     array_push($arr, array("user" => UserManager::getUserById($_fid), "lastlocation" => HistoryManager::getLastUserHistory($_fid), "state" => UserManager::getAvailable($_fid), "numberlist" => AccountManager::getNumbersById($_fid), "share" => "-1"));
     //require("closedb.php");
     return $arr[0];
 }
开发者ID:toantruonggithub,项目名称:findyourfriend,代码行数:11,代码来源:friend.php

示例12: authenticate

 /**
  * Authenticate user but doesn't verify if they are valid
  *
  * @param String $name
  * @param String $password
  * @return PFUser
  * @throws User_InvalidPasswordWithUserException
  * @throws User_InvalidPasswordException
  * @throws User_PasswordExpiredException
  */
 public function authenticate($name, $password)
 {
     $auth_success = false;
     $auth_user_id = null;
     $auth_user_status = null;
     $this->event_manager->processEvent(Event::SESSION_BEFORE_LOGIN, array('loginname' => $name, 'passwd' => $password, 'auth_success' => &$auth_success, 'auth_user_id' => &$auth_user_id, 'auth_user_status' => &$auth_user_status));
     if ($auth_success) {
         $user = $this->user_manager->getUserById($auth_user_id);
     } else {
         $user = $this->user_manager->getUserByUserName($name);
         if (!is_null($user)) {
             $auth_success = $this->authenticateFromDatabase($user, $password);
         }
     }
     if (!$user) {
         throw new User_InvalidPasswordException();
     } else {
         if (!$auth_success) {
             throw new User_InvalidPasswordWithUserException($user);
         }
     }
     return $user;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:33,代码来源:LoginManager.class.php

示例13: appendDocuments

 private function appendDocuments(DOMElement $parent_node, PFUser $admin_user, $doc_group_id)
 {
     foreach ($this->dao->searchAllDocs($doc_group_id) as $row) {
         $creator_name = $admin_user->getUserName();
         $creator = $this->user_manager->getUserById($row['created_by']);
         if ($creator !== null && ($creator->isActive() || $creator->isRestricted())) {
             $creator_name = $creator->getUnixName();
         }
         $document = $this->createDocument($row['title'], $row['description'], $row['createdate'], $row['updatedate'], $creator_name);
         $this->appendPermissions($document, $row['docid'], self::DOCUMENT_PERMISSION_TYPE);
         $this->appendFile($document, $row, $creator_name);
         $parent_node->appendChild($document);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:XMLExportData.class.php

示例14: userHavePermissionOnTracker

 private function userHavePermissionOnTracker(PFUser $user, Tracker_Artifact $artifact)
 {
     $permissions = $artifact->getTracker()->getAuthorizedUgroupsByPermissionType();
     foreach ($permissions as $permission_type => $ugroups) {
         switch ($permission_type) {
             case Tracker::PERMISSION_FULL:
                 foreach ($ugroups as $ugroup) {
                     if ($this->userBelongsToGroup($user, $artifact, $ugroup)) {
                         return true;
                     }
                 }
                 break;
             case Tracker::PERMISSION_SUBMITTER:
                 foreach ($ugroups as $ugroup) {
                     if ($this->userBelongsToGroup($user, $artifact, $ugroup)) {
                         // check that submitter is also a member
                         $submitter = $this->user_manager->getUserById($artifact->getSubmittedBy());
                         if ($this->userBelongsToGroup($submitter, $artifact, $ugroup)) {
                             return true;
                         }
                     }
                 }
                 break;
             case Tracker::PERMISSION_ASSIGNEE:
                 foreach ($ugroups as $ugroup) {
                     if ($this->userBelongsToGroup($user, $artifact, $ugroup)) {
                         // check that one of the assignees is also a member
                         $permission_assignee = new Tracker_Permission_PermissionRetrieveAssignee($this->user_manager);
                         foreach ($permission_assignee->getAssignees($artifact) as $assignee) {
                             if ($this->userBelongsToGroup($assignee, $artifact, $ugroup)) {
                                 return true;
                             }
                         }
                     }
                 }
                 break;
             case Tracker::PERMISSION_SUBMITTER_ONLY:
                 foreach ($ugroups as $ugroup) {
                     if ($this->userBelongsToGroup($user, $artifact, $ugroup)) {
                         if ($user->getId() == $artifact->getSubmittedBy()) {
                             return true;
                         }
                     }
                 }
                 break;
         }
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:49,代码来源:PermissionChecker.class.php

示例15: getUserById

 public function getUserById($userId, $initObjects = self::INIT_ALL, $cacheMinutes = 0, $cacheTag = null)
 {
     if ($this->memcache != null) {
         $key = $this->memcache->getNamespacedKey(self::USER_TAG . $userId);
         $cache = $this->memcache->get($key);
         if ($cache !== false and !empty($cache) and is_a($cache, "User") and isset($cache->id) and !empty($cache->id)) {
             return $cache;
         }
         $user = parent::getUserById($userId, self::INIT_ALL);
         $this->memcache->set($key, $user, 0);
         return $user;
     } else {
         return parent::getUserById($userId, $initObjects);
     }
 }
开发者ID:Welvin,项目名称:stingle,代码行数:15,代码来源:UserManagerCaching.class.php


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