本文整理匯總了PHP中JAccess::userGroups方法的典型用法代碼示例。如果您正苦於以下問題:PHP JAccess::userGroups方法的具體用法?PHP JAccess::userGroups怎麽用?PHP JAccess::userGroups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JAccess
的用法示例。
在下文中一共展示了JAccess::userGroups方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getGroupPath
/**
* Gets the parent groups that a leaf group belongs to in its branch back to the root of the tree
* (including the leaf group id).
*
* @param mixed $groupId An integer or array of integers representing the identities to check.
*
* @return mixed True if allowed, false for an explicit deny, null for an implicit deny.
*
* @since 11.1
*/
protected static function getGroupPath($groupId)
{
// Preload all groups
if (empty(self::$userGroups)) {
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('parent.id, parent.lft, parent.rgt')->from('#__usergroups AS parent')->order('parent.lft');
$db->setQuery($query);
self::$userGroups = $db->loadObjectList('id');
}
// Make sure groupId is valid
if (!array_key_exists($groupId, self::$userGroups)) {
return array();
}
// Get parent groups and leaf group
if (!isset(self::$userGroupPaths[$groupId])) {
self::$userGroupPaths[$groupId] = array();
foreach (self::$userGroups as $group) {
if ($group->lft <= self::$userGroups[$groupId]->lft && $group->rgt >= self::$userGroups[$groupId]->rgt) {
self::$userGroupPaths[$groupId][] = $group->id;
}
}
}
return self::$userGroupPaths[$groupId];
}
示例2: clearStatics
/**
* Method for clearing static caches.
*
* @return void
*
* @since 11.3
*/
public static function clearStatics()
{
self::$componentsPreloaded = false;
self::$viewLevels = array();
self::$assetPermissionsById = array();
self::$assetPermissionsByName = array();
self::$preloadedAssetTypes = array();
self::$identities = array();
self::$assetRules = array();
self::$userGroups = array();
self::$userGroupPaths = array();
self::$groupsByUser = array();
}