CRM_Contact_BAO_Contact_Permission
in package
Tags
Table of Contents
Properties
- $useTempTable : bool
Methods
- allow() : bool
- Check if the logged in user has permissions for the operation type.
- allowList() : array<string|int, mixed>
- Check which of the given contact IDs the logged in user has permissions for the operation type according to: - general permissions (e.g. 'edit all contacts') - deletion status (unless you have 'access deleted contacts') - ACL - permissions inherited through relationships (also second degree if enabled)
- cache() : mixed
- Fill the acl contact cache for this ACLed contact id if empty.
- cacheClause() : array<string|int, mixed>
- cacheSubquery() : string|null
- Generate acl subquery that can be placed in the WHERE clause of a query or the ON clause of a JOIN.
- getUseTemporaryTable() : bool
- Get variable for determining if we should use Temporary Table or not
- initChecksumAuthSrc() : mixed
- relationshipList() : array<string|int, mixed>
- Filter a list of contact_ids by the ones that the user as a permissioned relationship with
- setUseTemporaryTable() : mixed
- Set whether to use a temporary table or not when building ACL Cache
- validateChecksumContact() : bool
- validateOnlyChecksum() : bool
Properties
$useTempTable
public
static bool
$useTempTable
= \FALSE
Methods
allow()
Check if the logged in user has permissions for the operation type.
public
static allow(int $id[, int|string $type = CRM_Core_Permission::VIEW ][, int $userID = NULL ]) : bool
Parameters
- $id : int
-
Contact id.
- $type : int|string = CRM_Core_Permission::VIEW
-
the type of operation (view|edit)
- $userID : int = NULL
-
Contact id of user to check (defaults to current logged-in user)
Return values
bool —true if the user has permission, false otherwise
allowList()
Check which of the given contact IDs the logged in user has permissions for the operation type according to: - general permissions (e.g. 'edit all contacts') - deletion status (unless you have 'access deleted contacts') - ACL - permissions inherited through relationships (also second degree if enabled)
public
static allowList(array<string|int, mixed> $contact_ids[, int $type = CRM_Core_Permission::VIEW ]) : array<string|int, mixed>
Parameters
- $contact_ids : array<string|int, mixed>
-
Contact IDs.
- $type : int = CRM_Core_Permission::VIEW
-
the type of operation (view|edit)
Tags
Return values
array<string|int, mixed> —list of contact IDs the logged in user has the given permission for
cache()
Fill the acl contact cache for this ACLed contact id if empty.
public
static cache(int $userID[, int|string $type = CRM_Core_Permission::VIEW ][, bool $force = FALSE ]) : mixed
Parameters
- $userID : int
-
- contact_id of the ACLed user
- $type : int|string = CRM_Core_Permission::VIEW
-
the type of operation (view|edit)
- $force : bool = FALSE
-
- Should we force a recompute (only used for unit tests)
cacheClause()
public
static cacheClause([array<string|int, string>|string $contactAlias = 'contact_a' ]) : array<string|int, mixed>
Parameters
- $contactAlias : array<string|int, string>|string = 'contact_a'
Return values
array<string|int, mixed>cacheSubquery()
Generate acl subquery that can be placed in the WHERE clause of a query or the ON clause of a JOIN.
public
static cacheSubquery() : string|null
This is specifically for VIEW operations.
Return values
string|nullgetUseTemporaryTable()
Get variable for determining if we should use Temporary Table or not
public
static getUseTemporaryTable() : bool
Return values
boolinitChecksumAuthSrc()
public
static initChecksumAuthSrc([bool $checkSumValidationResult = FALSE ][, CRM_Core_Form|null $form = NULL ]) : mixed
Parameters
- $checkSumValidationResult : bool = FALSE
- $form : CRM_Core_Form|null = NULL
relationshipList()
Filter a list of contact_ids by the ones that the user as a permissioned relationship with
public
static relationshipList(array<string|int, mixed> $contact_ids, int $type[, int $userID = NULL ]) : array<string|int, mixed>
Parameters
- $contact_ids : array<string|int, mixed>
-
List of contact IDs to be filtered
- $type : int
-
access type CRM_Core_Permission::VIEW or CRM_Core_Permission::EDIT
- $userID : int = NULL
Return values
array<string|int, mixed> —List of contact IDs that the user has permissions for
setUseTemporaryTable()
Set whether to use a temporary table or not when building ACL Cache
public
static setUseTemporaryTable([bool $useTemporaryTable = TRUE ]) : mixed
Parameters
- $useTemporaryTable : bool = TRUE
validateChecksumContact()
public
static validateChecksumContact(int $contactID, CRM_Core_Form &$form[, bool $redirect = TRUE ]) : bool
Parameters
- $contactID : int
- $form : CRM_Core_Form
- $redirect : bool = TRUE
Return values
boolvalidateOnlyChecksum()
public
static validateOnlyChecksum(int $contactID, CRM_Core_Form &$form[, bool $redirect = TRUE ]) : bool
Parameters
- $contactID : int
- $form : CRM_Core_Form
- $redirect : bool = TRUE