[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Access/ -> Access.php (summary)

Joomla! Content Management System

Copyright: (C) 2009 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 1081 lines (40 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Access:: (20 methods):
  clearStatics()
  check()
  preload()
  getAssetAncestors()
  preloadPermissions()
  preloadComponents()
  checkGroup()
  getGroupPath()
  getAssetRules()
  cleanAssetKey()
  getAssetId()
  getAssetName()
  getExtensionNameFromAsset()
  getAssetType()
  getGroupTitle()
  getGroupsByUser()
  getUsersByGroup()
  getAuthorisedViewLevels()
  getActionsFromFile()
  getActionsFromData()


Class: Access  - X-Ref

Class that handles all access authorisation routines.

clearStatics()   X-Ref
Method for clearing static caches.

return: void

check($userId, $action, $assetKey = null, $preload = true)   X-Ref
Method to check if a user is authorised to perform an action, optionally on an asset.

param: integer         $userId    Id of the user for which to check authorisation.
param: string          $action    The name of the action to authorise.
param: integer|string  $assetKey  The asset key (asset id or asset name). null fallback to root asset.
param: boolean         $preload   Indicates whether preloading should be used.
return: boolean|null  True if allowed, false for an explicit deny, null for an implicit deny.

preload($assetTypes = 'components', $reload = false)   X-Ref
Method to preload the Rules object for the given asset type.

param: integer|string|array  $assetTypes  The type or name of the asset (e.g. 'com_content.article', 'com_menus.menu.2').
param: boolean               $reload      Set to true to reload from database.
return: boolean  True on success.

getAssetAncestors($assetType, $assetId)   X-Ref
Method to recursively retrieve the list of parent Asset IDs
for a particular Asset.

param: string   $assetType  The asset type, or the asset name, or the extension of the asset
param: integer  $assetId    The numeric asset id.
return: array  List of ancestor ids (includes original $assetId).

preloadPermissions($assetType, $reload = false)   X-Ref
Method to retrieve the Asset Rule strings for this particular
Asset Type and stores them for later usage in getAssetRules().
Stores 2 arrays: one where the list has the Asset ID as the key
and a second one where the Asset Name is the key.

param: string   $assetType  The asset type, or the asset name, or the extension of the asset
param: boolean  $reload     Reload the preloaded assets.
return: void

preloadComponents()   X-Ref
Method to preload the Rules objects for all components.

Note: This will only get the base permissions for the component.
e.g. it will get 'com_content', but not 'com_content.article.1' or
any more specific asset type rules.

return: array  Array of component names that were preloaded.

checkGroup($groupId, $action, $assetKey = null, $preload = true)   X-Ref
Method to check if a group is authorised to perform an action, optionally on an asset.

param: integer         $groupId   The path to the group for which to check authorisation.
param: string          $action    The name of the action to authorise.
param: integer|string  $assetKey  The asset key (asset id or asset name). null fallback to root asset.
param: boolean         $preload   Indicates whether preloading should be used.
return: boolean  True if authorised.

getGroupPath($groupId)   X-Ref
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.

getAssetRules($assetKey, $recursive = false, $recursiveParentAsset = true, $preload = true)   X-Ref
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.

param: integer|string  $assetKey              The asset key (asset id or asset name). null fallback to root asset.
param: boolean         $recursive             True to return the rules object with inherited rules.
param: boolean         $recursiveParentAsset  True to calculate the rule also based on inherited component/extension rules.
param: boolean         $preload               Indicates whether preloading should be used.
return: Rules  Rules object for the asset.

cleanAssetKey($assetKey = null)   X-Ref
Method to clean the asset key to make sure we always have something.

param: integer|string  $assetKey  The asset key (asset id or asset name). null fallback to root asset.
return: integer|string  Asset id or asset name.

getAssetId($assetKey)   X-Ref
Method to get the asset id from the asset key.

param: integer|string  $assetKey  The asset key (asset id or asset name).
return: integer  The asset id.

getAssetName($assetKey)   X-Ref
Method to get the asset name from the asset key.

param: integer|string  $assetKey  The asset key (asset id or asset name).
return: string  The asset name (ex: com_content.article.8).

getExtensionNameFromAsset($assetKey)   X-Ref
Method to get the extension name from the asset name.

param: integer|string  $assetKey  The asset key (asset id or asset name).
return: string  The extension name (ex: com_content).

getAssetType($assetKey)   X-Ref
Method to get the asset type from the asset name.

For top level components this returns "components":
'com_content' returns 'components'

For other types:
'com_content.article.1' returns 'com_content.article'
'com_content.category.1' returns 'com_content.category'

param: integer|string  $assetKey  The asset key (asset id or asset name).
return: string  The asset type (ex: com_content.article).

getGroupTitle($groupId)   X-Ref
Method to return the title of a user group

param: integer  $groupId  Id of the group for which to get the title of.
return: string  The title of the group

getGroupsByUser($userId, $recursive = true)   X-Ref
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.

param: integer  $userId     Id of the user for which to get the list of groups.
param: boolean  $recursive  True to include inherited user groups.
return: array    List of user group ids to which the user is mapped.

getUsersByGroup($groupId, $recursive = false)   X-Ref
Method to return a list of user Ids contained in a Group

param: integer  $groupId    The group Id
param: boolean  $recursive  Recursively include all child groups (optional)
return: array

getAuthorisedViewLevels($userId)   X-Ref
Method to return a list of view levels for which the user is authorised.

param: integer  $userId  Id of the user for which to get the list of authorised view levels.
return: array    List of view levels for which the user is authorised.

getActionsFromFile($file, $xpath = "/access/section[@name='component']/")   X-Ref
Method to return a list of actions from a file for which permissions can be set.

param: string  $file   The path to the XML file.
param: string  $xpath  An optional xpath to search for the fields.
return: boolean|array   False if case of error or the list of actions available.

getActionsFromData($data, $xpath = "/access/section[@name='component']/")   X-Ref
Method to return a list of actions from a string or from an xml for which permissions can be set.

param: string|\SimpleXMLElement  $data   The XML string or an XML element.
param: string                    $xpath  An optional xpath to search for the fields.
return: boolean|array   False if case of error or the list of actions available.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer