public static
|
#
clearStatics( )
Method for clearing static caches.
Method for clearing static caches.
Since
11.3
|
public static
boolean|null
|
#
check( integer $userId, string $action, integer|string $assetKey = null, boolean $preload = true )
Method to check if a user is authorised to perform an action, optionally on
an asset.
Method to check if a user is authorised to perform an action, optionally on
an asset.
Parameters
- $userId
integer - $userId Id of the user for which to check authorisation.
- $action
string - $action The name of the action to authorise.
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name). null fallback to root asset.
- $preload
boolean - $preload Indicates whether preloading should be used.
Returns
boolean|null - True if allowed, false for an explicit deny, null for an implicit deny.
Since
11.1
|
public static
boolean
|
#
preload( integer|string|array $assetTypes = 'components', boolean $reload = false )
Method to preload the JAccessRules object for the given asset type.
Method to preload the JAccessRules object for the given asset type.
Parameters
- $assetTypes
integer|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.
- $reload
boolean - $reload Set to true to reload from database.
Returns
boolean - True on success.
Since
1.6
Note
This method will return void in 4.0.
|
protected static
array
|
#
getAssetAncestors( string $assetType, integer $assetId )
Method to recursively retrieve the list of parent Asset IDs for a particular
Asset.
Method to recursively retrieve the list of parent Asset IDs for a particular
Asset.
Parameters
- $assetType
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').
- $assetId
integer - $assetId The numeric asset id.
Returns
array - List of ancestor ids (includes original $assetId).
Since
1.6
|
protected static
array
&
|
#
preloadPermissionsParentIdMapping( string $assetType )
Method to retrieve the list of Asset IDs and their Parent Asset IDs and store
them for later usage in getAssetRules().
Method to retrieve the list of Asset IDs and their Parent Asset IDs and store
them for later usage in getAssetRules().
Deprecated
3.7.0 No replacement. Will be removed in 4.0.
Parameters
- $assetType
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').
Returns
array - List of asset ids (includes parent asset id information).
Since
1.6
|
protected static
boolean
|
#
preloadPermissions( string $assetType, boolean $reload = false )
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.
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.
Parameters
- $assetType
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').
- $reload
boolean - $reload Reload the preloaded assets.
Returns
boolean - True
Since
1.6
Note
This function will return void in 4.0.
|
protected static
array
|
#
preloadComponents( )
Method to preload the JAccessRules objects for all components.
Method to preload the JAccessRules 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.
Returns
array - Array of component names that were preloaded.
Since
1.6
|
public static
boolean
|
#
checkGroup( integer $groupId, string $action, integer|string $assetKey = null, boolean $preload = true )
Method to check if a group is authorised to perform an action, optionally on
an asset.
Method to check if a group is authorised to perform an action, optionally on
an asset.
Parameters
- $groupId
integer - $groupId The path to the group for which to check authorisation.
- $action
string - $action The name of the action to authorise.
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name). null fallback to root asset.
- $preload
boolean - $preload Indicates whether preloading should be used.
Returns
boolean - True if authorised.
Since
11.1
|
protected static
mixed
|
#
getGroupPath( 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).
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
- $groupId
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
11.1
|
public static
JAccessRules
|
#
getAssetRules( integer|string $assetKey, boolean $recursive = false, boolean $recursiveParentAsset = true, boolean $preload = true )
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.
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.
Parameters
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name). null fallback to root asset.
- $recursive
boolean - $recursive True to return the rules object with inherited rules.
- $recursiveParentAsset
boolean - $recursiveParentAsset True to calculate the rule also based on inherited
component/extension rules.
- $preload
boolean - $preload Indicates whether preloading should be used.
Returns
Since
11.1
Note
The non preloading code will be removed in 4.0. All asset rules should use asset
preloading.
|
protected static
integer|string
|
#
cleanAssetKey( integer|string $assetKey = null )
Method to clean the asset key to make sure we always have something.
Method to clean the asset key to make sure we always have something.
Parameters
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name). null fallback to root asset.
Returns
integer|string - Asset id or asset name.
Since
3.7.0
|
protected static
integer
|
#
getAssetId( integer|string $assetKey )
Method to get the asset id from the asset key.
Method to get the asset id from the asset key.
Parameters
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name).
Returns
integer - The asset id.
Since
3.7.0
|
protected static
string
|
#
getAssetName( integer|string $assetKey )
Method to get the asset name from the asset key.
Method to get the asset name from the asset key.
Parameters
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name).
Returns
string - The asset name (ex: com_content.article.8).
Since
3.7.0
|
public static
string
|
#
getExtensionNameFromAsset( integer|string $assetKey )
Method to get the extension name from the asset name.
Method to get the extension name from the asset name.
Parameters
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name).
Returns
string - The extension name (ex: com_content).
Since
1.6
|
public static
string
|
#
getAssetType( integer|string $assetKey )
Method to get the asset type from the asset name.
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'
Parameters
- $assetKey
integer|string - $assetKey The asset key (asset id or asset name).
Returns
string - The asset type (ex: com_content.article).
Since
1.6
|
public static
string
|
#
getGroupTitle( integer $groupId )
Method to return the title of a user group
Method to return the title of a user group
Parameters
- $groupId
integer - $groupId Id of the group for which to get the title of.
Returns
string - Tthe title of the group
Since
3.5
|
public static
array
|
#
getGroupsByUser( integer $userId, boolean $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.
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
- $userId
integer - $userId Id of the user for which to get the list of groups.
- $recursive
boolean - $recursive True to include inherited user groups.
Returns
array - List of user group ids to which the user is mapped.
Since
11.1
|
public static
array
|
#
getUsersByGroup( integer $groupId, boolean $recursive = false )
Method to return a list of user Ids contained in a Group
Method to return a list of user Ids contained in a Group
Parameters
- $groupId
integer - $groupId The group Id
- $recursive
boolean - $recursive Recursively include all child groups (optional)
Returns
array
Since
11.1
|
public static
array
|
#
getAuthorisedViewLevels( integer $userId )
Method to return a list of view levels for which the user is authorised.
Method to return a list of view levels for which the user is authorised.
Parameters
- $userId
integer - $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
11.1
|
public static
array
|
#
getActions( string $component, string $section = 'component' )
Method to return a list of actions for which permissions can be set given a
component and section.
Method to return a list of actions for which permissions can be set given a
component and section.
Deprecated
12.3 (Platform) & 4.0 (CMS) Use JAccess::getActionsFromFile or
JAccess::getActionsFromData instead.
Parameters
- $component
string - $component The component from which to retrieve the actions.
- $section
string - $section The name of the section within the component from which to retrieve the
actions.
Returns
array - List of actions available for the given component and section.
Since
11.1
CodeCoverageIgnore
|
public static
boolean|array
|
#
getActionsFromFile( string $file, string $xpath = "/access/section[@name='component']/" )
Method to return a list of actions from a file for which permissions can be
set.
Method to return a list of actions from a file for which permissions can be
set.
Parameters
- $file
string - $file The path to the XML file.
- $xpath
string - $xpath An optional xpath to search for the fields.
Returns
boolean|array - False if case of error or the list of actions available.
Since
12.1
|
public static
boolean|array
|
#
getActionsFromData( string|SimpleXMLElement $data, string $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.
Method to return a list of actions from a string or from an xml for which
permissions can be set.
Parameters
- $data
string|SimpleXMLElement - $data The XML string or an XML element.
- $xpath
string - $xpath An optional xpath to search for the fields.
Returns
boolean|array - False if case of error or the list of actions available.
Since
12.1
|
protected static
array
|
$viewLevels
|
#
Array of view levels
Since
11.1
|
protected static
array
|
$assetRules
|
#
Array of rules for the asset
Array of rules for the asset
Since
11.1
|
protected static
array
|
$assetRulesIdentities
|
#
Array of identities for asset rules
Array of identities for asset rules
Since
11.1
|
protected static
array
|
$assetPermissionsById
|
#
Array of permissions for an asset type (Array Key = Asset ID) Also includes
the rules string for the asset
Array of permissions for an asset type (Array Key = Asset ID) Also includes
the rules string for the asset
Deprecated
3.7.0 No replacement. Will be removed in 4.0.
Since
11.1
|
protected static
array
|
$assetPermissionsByName
|
#
Array of permissions for an asset type (Array Key = Asset Name)
Array of permissions for an asset type (Array Key = Asset Name)
Deprecated
3.7.0 No replacement. Will be removed in 4.0.
Since
11.1
|
protected static
array
|
$assetPermissionsParentIdMapping
|
#
Array of the permission parent ID mappings
Array of the permission parent ID mappings
Since
11.1
|
protected static
array
|
$preloadedAssetTypes
|
#
Array of asset types that have been preloaded
Array of asset types that have been preloaded
Since
11.1
|
protected static
array
|
$identities
|
#
Array of loaded user identities
Array of loaded user identities
Since
11.1
|
protected static
array
|
$userGroups
|
#
Array of user groups.
Since
11.1
|
protected static
array
|
$userGroupPaths
|
#
Array of user group paths.
Array of user group paths.
Since
11.1
|
protected static
array
|
$groupsByUser
|
#
Array of cached groups by user.
Array of cached groups by user.
Since
11.1
|
protected static
array
|
$preloadedAssets
|
#
Array of preloaded asset names and ids (key is the asset id).
Array of preloaded asset names and ids (key is the asset id).
Since
3.7.0
|
protected static
integer
|
$rootAssetId
|
#
The root asset id.
Since
3.7.0
|