Back to Joomla project (class list)

Class Access - list of methods

Class that handles all access authorisation routines.
Package: Joomla\CMS\Access
Copyright: (C) 2009 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Access/Access.php
Project: Joomla

Method Summary

public static void
()

Method for clearing static caches.
Returns
  • void
Since
  • 1.7.3
Show source code of this method: clearStatics Source Code

public static bool|null
(mixed $userId, mixed $action, mixed $assetKey = null, mixed $preload = true)

Method to check if a user is authorised to perform an action, optionally on an asset.
Parameters
  • int $userId Id of the user for which to check authorisation.
  • string $action The name of the action to authorise.
  • int|string $assetKey The asset key (asset id or asset name). null fallback to root asset.
  • bool $preload Indicates whether preloading should be used.
Returns
  • bool|null True if allowed, false for an explicit deny, null for an implicit deny.
Since
  • 1.7.0
Show source code of this method: check Source Code

public static bool
(mixed $assetTypes = 'components', mixed $reload = false)

Method to preload the Rules object for the given asset type.
Parameters
  • int|string|array $assetTypes The type or name of the asset (e.g. 'com_content.article', 'com_menus.menu.2'). Also accepts the asset id. An array of asset type or a special 'components' string to load all component assets.
  • bool $reload Set to true to reload from database.
Returns
  • bool True on success.
Since
  • 1.6
-
  • This method will return void in 4.0.
Show source code of this method: preload Source Code

protected static array
(mixed $assetType, mixed $assetId)

Method to recursively retrieve the list of parent Asset IDs for a particular Asset.
Parameters
  • string $assetType The asset type, or the asset name, or the extension of the asset (e.g. 'com_content.article', 'com_menus.menu.2', 'com_contact').
  • int $assetId The numeric asset id.
Returns
  • array List of ancestor ids (includes original $assetId).
Since
  • 1.6
Show source code of this method: getAssetAncestors Source Code

protected static void
(mixed $assetType, mixed $reload = false)

Method to retrieve the Asset Rule strings for this particular Asset Type and stores them for later usage in getAssetRules().
Parameters
  • string $assetType The asset type, or the asset name, or the extension of the asset (e.g. 'com_content.article', 'com_menus.menu.2', 'com_contact').
  • bool $reload Reload the preloaded assets.
Returns
  • void
Since
  • 1.6
Show source code of this method: preloadPermissions Source Code

protected static array
()

Method to preload the Rules objects for all components.
Returns
  • array Array of component names that were preloaded.
Since
  • 1.6
Show source code of this method: preloadComponents Source Code

public static bool
(mixed $groupId, mixed $action, mixed $assetKey = null, mixed $preload = true)

Method to check if a group is authorised to perform an action, optionally on an asset.
Parameters
  • int $groupId The path to the group for which to check authorisation.
  • string $action The name of the action to authorise.
  • int|string $assetKey The asset key (asset id or asset name). null fallback to root asset.
  • bool $preload Indicates whether preloading should be used.
Returns
  • bool True if authorised.
Since
  • 1.7.0
Show source code of this method: checkGroup Source Code

protected static mixed
(mixed $groupId)

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).
Parameters
  • mixed $groupId An integer or array of integers representing the identities to check.
Returns
  • mixed True if allowed, false for an explicit deny, null for an implicit deny.
Since
  • 1.7.0
Show source code of this method: getGroupPath Source Code

public static \Joomla\CMS\Access\Rules
(mixed $assetKey, mixed $recursive = false, mixed $recursiveParentAsset = true, mixed $preload = true)

Method to return the Rules 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.
Parameters
  • int|string $assetKey The asset key (asset id or asset name). null fallback to root asset.
  • bool $recursive True to return the rules object with inherited rules.
  • bool $recursiveParentAsset True to calculate the rule also based on inherited component/extension rules.
  • bool $preload Indicates whether preloading should be used.
Returns
  • \Joomla\CMS\Access\Rules Rules object for the asset.
Since
  • 1.7.0
-
  • The non preloading code will be removed in 4.0. All asset rules should use asset preloading.
Show source code of this method: getAssetRules Source Code

protected static int|string
(mixed $assetKey = null)

Method to clean the asset key to make sure we always have something.
Parameters
  • int|string $assetKey The asset key (asset id or asset name). null fallback to root asset.
Returns
  • int|string Asset id or asset name.
Since
  • 3.7.0
Show source code of this method: cleanAssetKey Source Code

protected static int
(mixed $assetKey)

Method to get the asset id from the asset key.
Parameters
  • int|string $assetKey The asset key (asset id or asset name).
Returns
  • int The asset id.
Since
  • 3.7.0
Show source code of this method: getAssetId Source Code

protected static string
(mixed $assetKey)

Method to get the asset name from the asset key.
Parameters
  • int|string $assetKey The asset key (asset id or asset name).
Returns
  • string The asset name (ex: com_content.article.8).
Since
  • 3.7.0
Show source code of this method: getAssetName Source Code

public static string
(mixed $assetKey)

Method to get the extension name from the asset name.
Parameters
  • int|string $assetKey The asset key (asset id or asset name).
Returns
  • string The extension name (ex: com_content).
Since
  • 1.6
Show source code of this method: getExtensionNameFromAsset Source Code

public static string
(mixed $assetKey)

Method to get the asset type from the asset name.
Parameters
  • int|string $assetKey The asset key (asset id or asset name).
Returns
  • string The asset type (ex: com_content.article).
Since
  • 1.6
Show source code of this method: getAssetType Source Code

public static string
(mixed $groupId)

Method to return the title of a user group
Parameters
  • int $groupId Id of the group for which to get the title of.
Returns
  • string The title of the group
Since
  • 3.5
Show source code of this method: getGroupTitle Source Code

public static array
(mixed $userId, mixed $recursive = true)

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.
Parameters
  • int $userId Id of the user for which to get the list of groups.
  • bool $recursive True to include inherited user groups.
Returns
  • array List of user group ids to which the user is mapped.
Since
  • 1.7.0
Show source code of this method: getGroupsByUser Source Code

public static array
(mixed $groupId, mixed $recursive = false)

Method to return a list of user Ids contained in a Group
Parameters
  • int $groupId The group Id
  • bool $recursive Recursively include all child groups (optional)
Returns
  • array
Since
  • 1.7.0
-
  • This method should move somewhere else
Show source code of this method: getUsersByGroup Source Code

public static array
(mixed $userId)

Method to return a list of view levels for which the user is authorised.
Parameters
  • int $userId Id of the user for which to get the list of authorised view levels.
Returns
  • array List of view levels for which the user is authorised.
Since
  • 1.7.0
Show source code of this method: getAuthorisedViewLevels Source Code

public static bool|array
(mixed $file, mixed $xpath = "/access/section[@name='component']/")

Method to return a list of actions from a file for which permissions can be set.
Parameters
  • string $file The path to the XML file.
  • string $xpath An optional xpath to search for the fields.
Returns
  • bool|array False if case of error or the list of actions available.
Since
  • 3.0.0
Show source code of this method: getActionsFromFile Source Code

public static bool|array
(mixed $data, mixed $xpath = "/access/section[@name='component']/")

Method to return a list of actions from a string or from an xml for which permissions can be set.
Parameters
  • string|\SimpleXMLElement $data The XML string or an XML element.
  • string $xpath An optional xpath to search for the fields.
Returns
  • bool|array False if case of error or the list of actions available.
Since
  • 3.0.0
Show source code of this method: getActionsFromData Source Code

Properties Summary

protected static array
$viewLevels
Array of view levels
Since
  • 1.7.0
protected static array
$assetRules
Array of rules for the asset
Since
  • 1.7.0
protected static array
$assetRulesIdentities
Array of identities for asset rules
Since
  • 1.7.0
protected static array
$assetPermissionsParentIdMapping
Array of the permission parent ID mappings
Since
  • 1.7.0
protected static array
$preloadedAssetTypes
Array of asset types that have been preloaded
Since
  • 1.7.0
protected static array
$identities
Array of loaded user identities
Since
  • 1.7.0
protected static array
$userGroups
Array of user groups.
Since
  • 1.7.0
protected static array
$userGroupPaths
Array of user group paths.
Since
  • 1.7.0
protected static array
$groupsByUser
Array of cached groups by user.
Since
  • 1.7.0
protected static array
$preloadedAssets
Array of preloaded asset names and ids (key is the asset id).
Since
  • 3.7.0
protected static int
$rootAssetId
The root asset id.
Since
  • 3.7.0

Tags Summary

Since
1.7.0