예제 #1
0
 /**
  * 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
0
 /**
  * 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();
 }