本文整理汇总了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;
}