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


PHP AuthService::cacheRoles方法代码示例

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


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

示例1: listUsers

 /**
  * @static
  * @param string $baseGroup
  * @param null $regexp
  * @param $offset
  * @param $limit
  * @param bool $cleanLosts
  * @param bool $recursive
  * @param null $countCallback
  * @param null $loopCallback
  * @return AbstractAjxpUser[]
  */
 public static function listUsers($baseGroup = "/", $regexp = null, $offset = -1, $limit = -1, $cleanLosts = true, $recursive = true, $countCallback = null, $loopCallback = null)
 {
     $baseGroup = self::filterBaseGroup($baseGroup);
     $authDriver = ConfService::getAuthDriverImpl();
     $confDriver = ConfService::getConfStorageImpl();
     /**
      * @var $allUsers AbstractAjxpUser[]
      */
     $allUsers = array();
     $paginated = false;
     if (($regexp != null || $offset != -1 || $limit != -1) && $authDriver->supportsUsersPagination()) {
         $users = $authDriver->listUsersPaginated($baseGroup, $regexp, $offset, $limit, $recursive);
         $paginated = $offset != -1 || $limit != -1;
     } else {
         $users = $authDriver->listUsers($baseGroup);
     }
     $index = 0;
     // Callback func for display progression on cli mode
     if ($countCallback != null) {
         call_user_func($countCallback, $index, count($users), "Update users");
     }
     self::$cacheRoles = true;
     self::$roles = null;
     foreach (array_keys($users) as $userId) {
         if ($userId == "guest" && !ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || $userId == "ajxp.admin.users" || $userId == "") {
             continue;
         }
         if ($regexp != null && !$authDriver->supportsUsersPagination() && !preg_match("/{$regexp}/i", $userId)) {
             continue;
         }
         $allUsers[$userId] = $confDriver->createUserObject($userId);
         $index++;
         // Callback func for display progression on cli mode
         if ($countCallback != null) {
             call_user_func($loopCallback, $index);
         }
         if (empty($regexp) && $paginated) {
             // Make sure to reload all children objects
             foreach ($confDriver->getUserChildren($userId) as $childObject) {
                 $allUsers[$childObject->getId()] = $childObject;
             }
         }
     }
     self::$cacheRoles = false;
     if (empty($regexp) && $paginated && $cleanLosts) {
         // Remove 'lost' items (children without parents).
         foreach ($allUsers as $id => $object) {
             if ($object->hasParent() && !array_key_exists($object->getParent(), $allUsers)) {
                 unset($allUsers[$id]);
             }
         }
     }
     return $allUsers;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:66,代码来源:class.AuthService.php


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