Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe Access

Fonctions membres publiques statiques

static clearStatics ()
 
static check ($userId, $action, $assetKey=null, $preload=true)
 
static preload ($assetTypes='components', $reload=false)
 
static checkGroup ($groupId, $action, $assetKey=null, $preload=true)
 
static getAssetRules ($assetKey, $recursive=false, $recursiveParentAsset=true, $preload=true)
 
static getExtensionNameFromAsset ($assetKey)
 
static getAssetType ($assetKey)
 
static getGroupTitle ($groupId)
 
static getGroupsByUser ($userId, $recursive=true)
 
static getUsersByGroup ($groupId, $recursive=false)
 
static getAuthorisedViewLevels ($userId)
 
static getActions ($component, $section='component')
 
static getActionsFromFile ($file, $xpath="/access/section[@name='component']/")
 
static getActionsFromData ($data, $xpath="/access/section[@name='component']/")
 

Fonctions membres protégées statiques

static getAssetAncestors ($assetType, $assetId)
 
static & preloadPermissionsParentIdMapping ($assetType)
 
static preloadPermissions ($assetType, $reload=false)
 
static preloadComponents ()
 
static getGroupPath ($groupId)
 
static cleanAssetKey ($assetKey=null)
 
static getAssetId ($assetKey)
 
static getAssetName ($assetKey)
 

Attributs protégés statiques

static $viewLevels = array()
 
static $assetRules = array()
 
static $assetRulesIdentities = array()
 
static $assetPermissionsById = array()
 
static $assetPermissionsByName = array()
 
static $assetPermissionsParentIdMapping = array()
 
static $preloadedAssetTypes = array()
 
static $identities = array()
 
static $userGroups = array()
 
static $userGroupPaths = array()
 
static $groupsByUser = array()
 
static $preloadedAssets = array()
 
static $rootAssetId = null
 

Description détaillée

Class that handles all access authorisation routines.

Depuis
1.7.0

Documentation des fonctions membres

◆ check()

static check (   $userId,
  $action,
  $assetKey = null,
  $preload = true 
)
static

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

Paramètres
integer$userIdId of the user for which to check authorisation.
string$actionThe name of the action to authorise.
integer | string$assetKeyThe asset key (asset id or asset name). null fallback to root asset.
boolean$preloadIndicates whether preloading should be used.
Renvoie
boolean|null True if allowed, false for an explicit deny, null for an implicit deny.
Depuis
1.7.0

Références $action, et $userId.

Référencé par User\authorise(), et User\save().

◆ checkGroup()

static checkGroup (   $groupId,
  $action,
  $assetKey = null,
  $preload = true 
)
static

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

Paramètres
integer$groupIdThe path to the group for which to check authorisation.
string$actionThe name of the action to authorise.
integer | string$assetKeyThe asset key (asset id or asset name). null fallback to root asset.
boolean$preloadIndicates whether preloading should be used.
Renvoie
boolean True if authorised.
Depuis
1.7.0

Références $action.

Référencé par UserHelper\checkSuperUserInUsers(), UsergrouplistField\getOptions(), et User\save().

◆ cleanAssetKey()

static cleanAssetKey (   $assetKey = null)
staticprotected

Method to clean the asset key to make sure we always have something.

Paramètres
integer | string$assetKeyThe asset key (asset id or asset name). null fallback to root asset.
Renvoie
integer|string Asset id or asset name.
Depuis
3.7.0

Références null.

◆ clearStatics()

static clearStatics ( )
static

Method for clearing static caches.

Renvoie
void
Depuis
1.7.3

Références null.

Référencé par User\clearAccessRights().

◆ getActions()

static getActions (   $component,
  $section = 'component' 
)
static

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

Paramètres
string$componentThe component from which to retrieve the actions.
string$sectionThe name of the section within the component from which to retrieve the actions.
Renvoie
array List of actions available for the given component and section.
Depuis
1.7.0
Obsolète:
4.0 Use Access::getActionsFromFile or Access::getActionsFromData instead.

Références $component, $section, et JPATH_ADMINISTRATOR.

Référencé par RulesRule\getFieldActions().

◆ getActionsFromData()

static getActionsFromData (   $data,
  $xpath = "/access/section[@name='component']/" 
)
static

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

Paramètres
string | \SimpleXMLElement$dataThe XML string or an XML element.
string$xpathAn optional xpath to search for the fields.
Renvoie
boolean|array False if case of error or the list of actions available.
Depuis
3.0.0

Références $action, et $data.

◆ getActionsFromFile()

static getActionsFromFile (   $file,
  $xpath = "/access/section[@name='component']/" 
)
static

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

Paramètres
string$fileThe path to the XML file.
string$xpathAn optional xpath to search for the fields.
Renvoie
boolean|array False if case of error or the list of actions available.
Depuis
3.0.0

Références $file.

Référencé par ContentHelper\_getActions(), et ContentHelper\getActions().

◆ getAssetAncestors()

static getAssetAncestors (   $assetType,
  $assetId 
)
staticprotected

Method to recursively retrieve the list of parent Asset IDs for a particular Asset.

Paramètres
string$assetTypeThe asset type, or the asset name, or the extension of the asset (e.g. 'com_content.article', 'com_menus.menu.2', 'com_contact').
integer$assetIdThe numeric asset id.
Renvoie
array List of ancestor ids (includes original $assetId).
Depuis
1.6

Références $assetId, et $id.

◆ getAssetId()

static getAssetId (   $assetKey)
staticprotected

Method to get the asset id from the asset key.

Paramètres
integer | string$assetKeyThe asset key (asset id or asset name).
Renvoie
integer The asset id.
Depuis
3.7.0

Références null.

◆ getAssetName()

static getAssetName (   $assetKey)
staticprotected

Method to get the asset name from the asset key.

Paramètres
integer | string$assetKeyThe asset key (asset id or asset name).
Renvoie
string The asset name (ex: com_content.article.8).
Depuis
3.7.0

Références elseif, et null.

◆ getAssetRules()

static getAssetRules (   $assetKey,
  $recursive = false,
  $recursiveParentAsset = true,
  $preload = true 
)
static

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ètres
integer | string$assetKeyThe asset key (asset id or asset name). null fallback to root asset.
boolean$recursiveTrue to return the rules object with inherited rules.
boolean$recursiveParentAssetTrue to calculate the rule also based on inherited component/extension rules.
boolean$preloadIndicates whether preloading should be used.
Renvoie
Rules Rules object for the asset.
Depuis
1.7.0
Note
The non preloading code will be removed in 4.0. All asset rules should use asset preloading.

Hashing the collected rules allows us to store only one instance of the Rules object for Assets that have the same exact permissions... it's a great way to save some memory.

Références $asset, $assetId, $db, $hash, $id, $query, JDEBUG, Rules\mergeCollection(), name, et null.

Référencé par User\authorise(), et Content\getDefaultAssetValues().

◆ getAssetType()

static getAssetType (   $assetKey)
static

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ètres
integer | string$assetKeyThe asset key (asset id or asset name).
Renvoie
string The asset type (ex: com_content.article).
Depuis
1.6

◆ getAuthorisedViewLevels()

static getAuthorisedViewLevels (   $userId)
static

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

Paramètres
integer$userIdId of the user for which to get the list of authorised view levels.
Renvoie
array List of view levels for which the user is authorised.
Depuis
1.7.0

Références $authorised, $db, $groups, $id, $query, $user, $userId, et elseif.

Référencé par User\getAuthorisedViewLevels().

◆ getExtensionNameFromAsset()

static getExtensionNameFromAsset (   $assetKey)
static

Method to get the extension name from the asset name.

Paramètres
integer | string$assetKeyThe asset key (asset id or asset name).
Renvoie
string The extension name (ex: com_content).
Depuis
1.6

◆ getGroupPath()

static getGroupPath (   $groupId)
staticprotected

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ètres
mixed$groupIdAn integer or array of integers representing the identities to check.
Renvoie
mixed True if allowed, false for an explicit deny, null for an implicit deny.
Depuis
1.7.0

Références $groups.

◆ getGroupsByUser()

static getGroupsByUser (   $userId,
  $recursive = true 
)
static

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ètres
integer$userIdId of the user for which to get the list of groups.
boolean$recursiveTrue to include inherited user groups.
Renvoie
array List of user group ids to which the user is mapped.
Depuis
1.7.0

Références $db, $query, $userId, et ArrayHelper\toInteger().

Référencé par ComponentHelper\filterText(), et User\getAuthorisedGroups().

◆ getGroupTitle()

static getGroupTitle (   $groupId)
static

Method to return the title of a user group

Paramètres
integer$groupIdId of the group for which to get the title of.
Renvoie
string The title of the group
Depuis
3.5

Références $db, et $query.

◆ getUsersByGroup()

static getUsersByGroup (   $groupId,
  $recursive = false 
)
static

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

Paramètres
integer$groupIdThe group Id
boolean$recursiveRecursively include all child groups (optional)
Renvoie
array
Depuis
1.7.0

Références $db, $query, et ArrayHelper\toInteger().

◆ preload()

static preload (   $assetTypes = 'components',
  $reload = false 
)
static

Method to preload the Rules object for the given asset type.

Paramètres
integer | string | array$assetTypesThe 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.
boolean$reloadSet to true to reload from database.
Renvoie
boolean True on success.
Depuis
1.6
Note
This method will return void in 4.0.

◆ preloadComponents()

static preloadComponents ( )
staticprotected

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.

Renvoie
array Array of component names that were preloaded.
Depuis
1.6

Références $asset, $component, $db, $query, JDEBUG, et null.

◆ preloadPermissions()

static preloadPermissions (   $assetType,
  $reload = false 
)
staticprotected

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ètres
string$assetTypeThe asset type, or the asset name, or the extension of the asset (e.g. 'com_content.article', 'com_menus.menu.2', 'com_contact').
boolean$reloadReload the preloaded assets.
Renvoie
boolean True
Depuis
1.6
Note
This function will return void in 4.0.

Références $asset, $db, $query, et JDEBUG.

◆ preloadPermissionsParentIdMapping()

static& preloadPermissionsParentIdMapping (   $assetType)
staticprotected

Method to retrieve the list of Asset IDs and their Parent Asset IDs and store them for later usage in getAssetRules().

Paramètres
string$assetTypeThe asset type, or the asset name, or the extension of the asset (e.g. 'com_content.article', 'com_menus.menu.2', 'com_contact').
Renvoie
array List of asset ids (includes parent asset id information).
Depuis
1.6
Obsolète:
3.7.0 No replacement. Will be removed in 4.0.

Références $db, et $query.

Documentation des champs

◆ $assetPermissionsById

$assetPermissionsById = array()
staticprotected

◆ $assetPermissionsByName

$assetPermissionsByName = array()
staticprotected

◆ $assetPermissionsParentIdMapping

$assetPermissionsParentIdMapping = array()
staticprotected

◆ $assetRules

$assetRules = array()
staticprotected

◆ $assetRulesIdentities

$assetRulesIdentities = array()
staticprotected

◆ $groupsByUser

$groupsByUser = array()
staticprotected

◆ $identities

$identities = array()
staticprotected

◆ $preloadedAssets

$preloadedAssets = array()
staticprotected

◆ $preloadedAssetTypes

$preloadedAssetTypes = array()
staticprotected

◆ $rootAssetId

$rootAssetId = null
staticprotected

◆ $userGroupPaths

$userGroupPaths = array()
staticprotected

◆ $userGroups

$userGroups = array()
staticprotected

◆ $viewLevels

$viewLevels = array()
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :