hasPermission

API Quick reference
Variable name: hasPermission
CMS versions: 0.9.x + Evo
Variable type: boolean
Object parent:

API:hasPermission

Description

boolean hasPermission(string $pm);

Returns true if user has the specified permission

  • $pm - name of the permission

Usage / Examples

$fileAccess = $modx->hasPermission('file_manager');

Returns true if the user has file_manager access permissions, false if he does not.

Related

Notes

These permissions are set according to the user's role.

Function Source

function hasPermission($pm) {
$state= false;
$pms= $_SESSION['mgrPermissions'];
if ($pms)
$state= ($pms[$pm] == 1);
return $state;
}

Suggest an edit to this page.