CRM_Core_Permission
class CRM_Core_Permission
This is the basic permission class wrapper
Constants
EDIT_GROUPS |
Static strings used to compose permissions. |
VIEW_GROUPS |
Static strings used to compose permissions. |
EDIT |
The various type of permissions. |
VIEW |
The various type of permissions. |
DELETE |
The various type of permissions. |
CREATE |
The various type of permissions. |
SEARCH |
The various type of permissions. |
ALL |
The various type of permissions. |
ADMIN |
The various type of permissions. |
ALWAYS_DENY_PERMISSION |
A placeholder permission which always fails. |
ALWAYS_ALLOW_PERMISSION |
A placeholder permission which always fails. |
AUTH_SRC_UNKNOWN |
Various authentication sources. |
AUTH_SRC_CHECKSUM |
Various authentication sources. |
AUTH_SRC_SITEKEY |
Various authentication sources. |
AUTH_SRC_LOGIN |
Various authentication sources. |
Methods
Get the current permission of this user.
Given a permission string or array, check for access requirements
Determine if any one of the permissions strings applies to current user.
Given a group/role array, check for access requirements
Get the permissioned where clause for the user.
Get all groups from database, filtered by permissions for this user
No description
No description
No description
No description
No description
No description
No description
No description
Checks that component is enabled and optionally that user has basic perm.
Check permissions for delete and edit actions.
No description
No description
No description
No description
No description
No description
Get core permissions.
For each entity provides an array of permissions required for each action
Translate an unknown action to a canonical form.
Validate user permission across.
Get component name from given permission.
Get all the contact emails for users that have a specific permission.
Get all the contact emails for users that have a specific role.
No description
Verify if the user has permission to get the invoice.
Details
at line 77
static string
getPermission()
Get the current permission of this user.
at line 118
static bool
check(string|array $permissions, int $contactId = NULL)
Given a permission string or array, check for access requirements
Ex 1: Must have 'access CiviCRM' (string) 'access CiviCRM'
Ex 2: Must have 'access CiviCRM' and 'access Ajax API' ['access CiviCRM', 'access Ajax API']
Ex 3: Must have 'access CiviCRM' or 'access Ajax API' [ ['access CiviCRM', 'access Ajax API'], ],
Ex 4: Must have 'access CiviCRM' or 'access Ajax API' AND 'access CiviEvent' [ ['access CiviCRM', 'access Ajax API'], 'access CiviEvent', ],
Note that in permissions.php this is keyed by the action eg. (access Civi || access AJAX) && (access CiviEvent || access CiviContribute) 'myaction' => [ ['access CiviCRM', 'access Ajax API'], ['access CiviEvent', 'access CiviContribute'] ],
at line 159
static bool
checkAnyPerm(array $perms)
Determine if any one of the permissions strings applies to current user.
at line 177
static bool
checkGroupRole(array $array)
Given a group/role array, check for access requirements
at line 195
static string
getPermissionedStaticGroupClause(int $type, array $tables, array $whereTables)
Get the permissioned where clause for the user.
at line 213
static array
group(string $groupType, bool $excludeHidden = TRUE)
Get all groups from database, filtered by permissions for this user
at line 221
static bool
customGroupAdmin()
at line 250
static array
customGroup(int $type = CRM_Core_Permission::VIEW, bool $reset = FALSE)
at line 271
static string
customGroupClause(int $type = CRM_Core_Permission::VIEW, null $prefix = NULL, bool $reset = FALSE)
at line 291
static bool
ufGroupValid(int $gid, int $type = CRM_Core_Permission::VIEW)
at line 305
static array
ufGroup(int $type = CRM_Core_Permission::VIEW)
at line 351
static array|string
ufGroupClause(int $type = CRM_Core_Permission::VIEW, null $prefix = NULL, bool $returnUFGroupIds = FALSE)
at line 371
static array|null
event(int $type = CRM_Core_Permission::VIEW, int $eventID = NULL, string $context = '')
at line 407
static string
eventClause(int $type = CRM_Core_Permission::VIEW, null $prefix = NULL)
at line 433
static bool
access(string $module, bool $checkPermission = TRUE, bool $requireAllCasesPermOnCiviCase = FALSE)
Checks that component is enabled and optionally that user has basic perm.
at line 469
static bool
checkActionPermission(string $module, int $action)
Check permissions for delete and edit actions.
at line 502
static bool
checkMenu($args, string $op = 'and')
at line 524
static bool|mixed
checkMenuItem($item)
at line 582
static array
basicPermissions(bool $all = FALSE, bool $descriptions = FALSE)
at line 597
static array
assembleBasicPermissions(bool $all = FALSE, bool $descriptions = FALSE)
at line 650
static array
getAnonymousPermissionsWarnings()
at line 672
static array
validateForPermissionWarnings($anonymous_perms)
at line 681
static array
getCorePermissions()
Get core permissions.
at line 935
static array
getEntityActionPermissions()
For each entity provides an array of permissions required for each action
The action is the array key, possible values: * create: applies to create (with no id in params) * update: applies to update, setvalue, create (with id in params) * get: applies to getcount, getsingle, getvalue and other gets * delete: applies to delete, replace * meta: applies to getfields, getoptions, getspec * default: catch-all for anything not declared
Note: some APIs declare other actions as well
Permissions should use arrays for AND and arrays of arrays for OR
at line 1519
static string
getGenericAction(string $action)
Translate an unknown action to a canonical form.
at line 1546
static bool
giveMeAllACLs()
Validate user permission across.
edit or view or with supportable acls.
at line 1586
static null|string
getComponentName(string $permission)
Get component name from given permission.
at line 1623
static string
permissionEmails(string $permissionName)
Get all the contact emails for users that have a specific permission.
at line 1637
static string
roleEmails(string $roleName)
Get all the contact emails for users that have a specific role.
at line 1645
static bool
isMultisiteEnabled()
at line 1656
static bool
checkDownloadInvoice()
Verify if the user has permission to get the invoice.