class CRM_ACL_API

Constants

EDIT

The various type of permissions.

VIEW

DELETE

CREATE

SEARCH

ALL

Methods

static bool
check(string $str, int $contactID = NULL)

Given a permission string, check for access requirements

static string
whereClause(int $type, array $tables, array $whereTables, int $contactID = NULL, bool $onlyDeleted = FALSE, bool $skipDeleteClause = FALSE, bool $skipOwnContactClause = FALSE)

Get the permissioned where clause for the user.

static array
group(int $type, int $contactID = NULL, string $tableName = 'civicrm_saved_search', null $allGroups = NULL, null $includedGroups = NULL)

Get all the groups the user has access to for the given operation.

static bool
groupPermission(int $type, int $groupID, int $contactID = NULL, string $tableName = 'civicrm_saved_search', null $allGroups = NULL, null $includedGroups = NULL)

Check if the user has access to this group for operation $type

Details

at line 58
static bool check(string $str, int $contactID = NULL)

Given a permission string, check for access requirements

Parameters

string $str The permission to check.
int $contactID The contactID for whom the check is made.

Return Value

bool true if yes, else false

at line 95
static string whereClause(int $type, array $tables, array $whereTables, int $contactID = NULL, bool $onlyDeleted = FALSE, bool $skipDeleteClause = FALSE, bool $skipOwnContactClause = FALSE)

Get the permissioned where clause for the user.

Parameters

int $type The type of permission needed.
array $tables (reference ) add the tables that are needed for the select clause.
array $whereTables (reference ) add the tables that are needed for the where clause.
int $contactID The contactID for whom the check is made.
bool $onlyDeleted Whether to include only deleted contacts.
bool $skipDeleteClause Don't add delete clause if this is true,. this means it is handled by generating query
bool $skipOwnContactClause Do not add 'OR contact_id = $userID' to the where clause. This is a hideously inefficient query and should be avoided wherever possible.

Return Value

string the group where clause for this user

at line 163
static array group(int $type, int $contactID = NULL, string $tableName = 'civicrm_saved_search', null $allGroups = NULL, null $includedGroups = NULL)

Get all the groups the user has access to for the given operation.

Parameters

int $type The type of permission needed.
int $contactID The contactID for whom the check is made.
string $tableName
null $allGroups
null $includedGroups

Return Value

array the ids of the groups for which the user has permissions

at line 196
static bool groupPermission(int $type, int $groupID, int $contactID = NULL, string $tableName = 'civicrm_saved_search', null $allGroups = NULL, null $includedGroups = NULL)

Check if the user has access to this group for operation $type

Parameters

int $type The type of permission needed.
int $groupID
int $contactID The contactID for whom the check is made.
string $tableName
null $allGroups
null $includedGroups

Return Value

bool