JAccess

Class that handles all access authorisation routines.

package

Joomla.Platform

subpackage

Access

since

11.1

Methods

check

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

check(integer $userId, string $action, mixed $asset = null) : boolean
static
since

11.1

Arguments

$userId

integerId of the user for which to check authorisation.

$action

stringThe name of the action to authorise.

$asset

mixedInteger asset id or the name of the asset as a string. Defaults to the global asset node.

Response

booleanTrue if authorised.

checkGroup

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

checkGroup(integer $groupId, string $action, mixed $asset = null) : boolean
static
since

11.1

Arguments

$groupId

integerThe path to the group for which to check authorisation.

$action

stringThe name of the action to authorise.

$asset

mixedInteger asset id or the name of the asset as a string. Defaults to the global asset node.

Response

booleanTrue if authorised.

clearStatics

Method for clearing static caches.

clearStatics() : void
static
since

11.3

getActions

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

getActions(string $component, string $section = 'component') : array
static deprecated
since

11.1

deprecated

12.3 Use JAccess::getActionsFromFile or JAccess::getActionsFromData instead.

Arguments

$component

stringThe component from which to retrieve the actions.

$section

stringThe name of the section within the component from which to retrieve the actions.

Response

arrayList of actions available for the given component and section.

getActionsFromData

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

getActionsFromData(string|\SimpleXMLElement $data, string $xpath = "/access/section[@name='component']/") : boolean|array
static
since

12.1

Arguments

$data

string|\SimpleXMLElementThe XML string or an XML element.

$xpath

stringAn optional xpath to search for the fields.

Response

boolean|arrayFalse if case of error or the list of actions available.

getActionsFromFile

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

getActionsFromFile(string $file, string $xpath = "/access/section[@name='component']/") : boolean|array
static
since

12.1

Arguments

$file

stringThe path to the XML file.

$xpath

stringAn optional xpath to search for the fields.

Response

boolean|arrayFalse if case of error or the list of actions available.

getAssetRules

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.

getAssetRules(mixed $asset, boolean $recursive = false) : \JAccessRules
static
since

11.1

Arguments

$asset

mixedInteger asset id or the name of the asset as a string.

$recursive

booleanTrue to return the rules object with inherited rules.

Response

\JAccessRulesJAccessRules object for the asset.

getAuthorisedViewLevels

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

getAuthorisedViewLevels(integer $userId) : array
static
since

11.1

Arguments

$userId

integerId of the user for which to get the list of authorised view levels.

Response

arrayList of view levels for which the user is authorised.

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

getGroupPath(mixed $groupId) : mixed
static
since

11.1

Arguments

$groupId

mixedAn integer or array of integers representing the identities to check.

Response

mixedTrue if allowed, false for an explicit deny, null for an implicit deny.

getGroupsByUser

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.

getGroupsByUser(integer $userId, boolean $recursive = true) : array
static
since

11.1

Arguments

$userId

integerId of the user for which to get the list of groups.

$recursive

booleanTrue to include inherited user groups.

Response

arrayList of user group ids to which the user is mapped.

getUsersByGroup

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

getUsersByGroup(integer $groupId, boolean $recursive = false) : array
static
since

11.1

todo

This method should move somewhere else

Arguments

$groupId

integerThe group Id

$recursive

booleanRecursively include all child groups (optional)

Response

array

Properties

viewLevels

Array of view levels

static
since

11.1

Type(s)

array

assetRules

Array of rules for the asset

static
since

11.1

Type(s)

array

userGroups

Array of user groups.

static
since

11.1

Type(s)

array

userGroupPaths

Array of user group paths.

static
since

11.1

Type(s)

array

groupsByUser

Array of cached groups by user.

static
since

11.1

Type(s)

array