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


PHP UserManager::getUserByIdentifier方法代码示例

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


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

示例1: getUserByName

 /**
  * Returns the user that match the given string
  *
  * @param String $user_name
  * @return PFUser
  * @throws Exception
  */
 public function getUserByName($user_name)
 {
     $user = $this->user_manager->getUserByIdentifier($user_name);
     if ($user && $user->isAlive()) {
         return $user;
     }
     throw new Exception('Invalid user');
 }
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:15,代码来源:SVN_Hooks.class.php

示例2: getUser

 /**
  * @param SimpleXMLElement $xml_element
  * @return PFUser
  */
 public function getUser(SimpleXMLElement $xml_element)
 {
     $submitter = $this->user_manager->getUserByIdentifier($this->getUserFormat($xml_element));
     if (!$submitter) {
         $submitter = $this->user_manager->getUserAnonymous();
         $submitter->setEmail((string) $xml_element);
     }
     return $submitter;
 }
开发者ID:ndjido,项目名称:tuleap,代码行数:13,代码来源:TrackerXMLImportHelper.class.php

示例3: getFieldDataFromRESTObject

 public function getFieldDataFromRESTObject(array $rest_data, Tracker_FormElement_Field_List $field)
 {
     if (isset($rest_data['id']) && is_numeric($rest_data['id'])) {
         $id = (int) $rest_data['id'];
         $user = $this->getValue($id);
         if (!$user) {
             throw new Tracker_FormElement_InvalidFieldValueException('Cannot Bind to user with ID ' . $id . ' for field ID ' . $field->getId());
         }
         return Tracker_FormElement_Field_OpenList::BIND_PREFIX . $id;
     }
     if (isset($rest_data['username'])) {
         $identifier = (string) $rest_data['username'];
         $user = $this->userManager->getUserByIdentifier($identifier);
         if (!$user) {
             throw new Tracker_FormElement_InvalidFieldValueException('Cannot Bind to user "' . $identifier . '" for field ID ' . $field->getId());
         }
         return Tracker_FormElement_Field_OpenList::BIND_PREFIX . $user->getId();
     }
     if (!isset($rest_data['email'])) {
         throw new Tracker_FormElement_InvalidFieldValueException('OpenList user fields values should be passed as an object with at least one of the properties "id", "username" or "email"');
     }
     $identifier = (string) $rest_data['email'];
     $user = $this->userManager->getUserByIdentifier("email:{$identifier}");
     if (!$user) {
         return Tracker_FormElement_Field_OpenList::NEW_VALUE_PREFIX . $identifier;
     }
     return Tracker_FormElement_Field_OpenList::BIND_PREFIX . $user->getId();
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:28,代码来源:Tracker_FormElement_Field_List_Bind_Users.class.php

示例4: getListOfUgroupMember

 /**
  * @param SimpleXMLElement $ugroup
  *
  * @return PFUser[]
  */
 private function getListOfUgroupMember(SimpleXMLElement $ugroup)
 {
     $ugroup_members = array();
     foreach ($ugroup->members->member as $xml_member) {
         $identifier = $this->xml_helper->getUserFormat($xml_member);
         $user = $this->user_manager->getUserByIdentifier($identifier);
         if (!$user) {
             $this->logger->debug("User ({$identifier}) does not exist -> skipped");
             continue;
         }
         $ugroup_members[] = $user;
     }
     return $ugroup_members;
 }
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:19,代码来源:ProjectXMLImporter.class.php

示例5: isValid

 public function isValid($value)
 {
     if ($value) {
         $values = explode(',', $value);
         foreach ($values as $v) {
             if (stripos($v, '!') !== false) {
                 //we check the string is an email
                 $rule = new Rule_Email();
                 if (!$rule->isValid($v)) {
                     //we check the string correspond to a username
                     if (!$this->userManager->getUserByIdentifier(substr($v, 1))) {
                         return false;
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:amanikamail,项目名称:tuleap,代码行数:19,代码来源:Tracker_FormElement_Field_List_Bind_Users.class.php


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