Joomla! Platform 12.1

 Class JAccess

Description

Class that handles all access authorisation routines.

  • since: 11.1

Located in /libraries/joomla/access/access.php (line 21)

Class JAccess   (Subpackage Access)
Variable Summary
Static variable static array $assetRules
Static variable static array $groupsByUser
Static variable static array $userGroupPaths
Static variable static array $userGroups
Static variable static array $viewLevels
Method Summary
Static method static boolean check (integer $userId, string $action, [mixed $asset = null])
Static method static boolean checkGroup (integer $groupId, string $action, [mixed $asset = null])
Static method static void clearStatics ()
Static method static array getActions (string $component, [string $section = 'component'])
Static method static boolean|array getActionsFromData (string|SimpleXMLElement $data, [string $xpath = "/access/section[@name='component']/"])
Static method static boolean|array getActionsFromFile (string $file, [string $xpath = "/access/section[@name='component']/"])
Static method static JAccessRules getAssetRules (mixed $asset, [boolean $recursive = false])
Static method static array getAuthorisedViewLevels (integer $userId)
Static method static mixed getGroupPath (mixed $groupId)
Static method static array getGroupsByUser (integer $userId, [boolean $recursive = true])
Static method static array getUsersByGroup (integer $groupId, [boolean $recursive = false])
Variables
array $assetRules = array() (line 37)

Array of rules for the asset

  • since: 11.1
  • access: protected
array $groupsByUser = array() (line 61)

Array of cached groups by user.

  • since: 11.1
  • access: protected
array $userGroupPaths = array() (line 53)

Array of user group paths.

  • since: 11.1
  • access: protected
array $userGroups = array() (line 45)

Array of user groups.

  • since: 11.1
  • access: protected
array $viewLevels = array() (line 29)

Array of view levels

  • since: 11.1
  • access: protected
Methods
check (line 90)

Method to check if a user is authorised to perform an action, optionally on an asset.

  • return: True if authorised.
  • since: 11.1
  • access: public
boolean check (integer $userId, string $action, [mixed $asset = null])
  • integer $userId: Id of the user for which to check authorisation.
  • string $action: The name of the action to authorise.
  • mixed $asset: Integer asset id or the name of the asset as a string. Defaults to the global asset node.
checkGroup (line 128)

Method to check if a group is authorised to perform an action, optionally on an asset.

  • return: True if authorised.
  • since: 11.1
  • access: public
boolean checkGroup (integer $groupId, string $action, [mixed $asset = null])
  • integer $groupId: The path to the group for which to check authorisation.
  • string $action: The name of the action to authorise.
  • mixed $asset: Integer asset id or the name of the asset as a string. Defaults to the global asset node.
clearStatics (line 70)

Method for clearing static caches.

  • since: 11.3
  • access: public
void clearStatics ()
getActions (line 462)

Method to return a list of actions for which permissions can be set given a component and section.

  • return: List of actions available for the given component and section.
  • deprecated: 12.3 Use JAccess::getActionsFromFile or JAccess::getActionsFromData instead.
  • todo: Need to decouple this method from the CMS. Maybe check if $component is a valid file (or create a getActionsFromFile method).
  • since: 11.1
  • access: public
array getActions (string $component, [string $section = 'component'])
  • string $component: The component from which to retrieve the actions.
  • string $section: The name of the section within the component from which to retrieve the actions.
getActionsFromData (line 513)

Method to return a list of actions from a string or from an xml for which permissions can be set.

  • return: False if case of error or the list of actions available.
  • since: 12.1
  • access: public
boolean|array getActionsFromData (string|SimpleXMLElement $data, [string $xpath = "/access/section[@name='component']/"])
  • string|SimpleXMLElement $data: The XML string or an XML element.
  • string $xpath: An optional xpath to search for the fields.
getActionsFromFile (line 489)

Method to return a list of actions from a file for which permissions can be set.

  • return: False if case of error or the list of actions available.
  • since: 12.1
  • access: public
boolean|array getActionsFromFile (string $file, [string $xpath = "/access/section[@name='component']/"])
  • string $file: The path to the XML file.
  • string $xpath: An optional xpath to search for the fields.
getAssetRules (line 212)

Method to return the JAccessRules object for an asset. The returned object can optionally hold only the rules explicitly set for the asset or the summation of all inherited rules from parent assets and explicit rules.

  • return: JAccessRules object for the asset.
  • since: 11.1
  • access: public
JAccessRules getAssetRules (mixed $asset, [boolean $recursive = false])
  • mixed $asset: Integer asset id or the name of the asset as a string.
  • boolean $recursive: True to return the rules object with inherited rules.
getAuthorisedViewLevels (line 394)

Method to return a list of view levels for which the user is authorised.

  • return: List of view levels for which the user is authorised.
  • since: 11.1
  • access: public
array getAuthorisedViewLevels (integer $userId)
  • integer $userId: Id of the user for which to get the list of authorised view levels.
getGroupPath (line 163)

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).

  • return: True if allowed, false for an explicit deny, null for an implicit deny.
  • since: 11.1
  • access: protected
mixed getGroupPath (mixed $groupId)
  • mixed $groupId: An integer or array of integers representing the identities to check.
getGroupsByUser (line 278)

Method to return a list of user groups mapped to a user. The returned list can optionally hold only the groups explicitly mapped to the user or all groups both explicitly mapped and inherited by the user.

  • return: List of user group ids to which the user is mapped.
  • since: 11.1
  • access: public
array getGroupsByUser (integer $userId, [boolean $recursive = true])
  • integer $userId: Id of the user for which to get the list of groups.
  • boolean $recursive: True to include inherited user groups.
getUsersByGroup (line 360)

Method to return a list of user Ids contained in a Group

  • todo: This method should move somewhere else
  • since: 11.1
  • access: public
array getUsersByGroup (integer $groupId, [boolean $recursive = false])
  • integer $groupId: The group Id
  • boolean $recursive: Recursively include all child groups (optional)
/html>