Documentation

CRM_ACL_API
in package

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Constants

ALL  = 6
CREATE  = 4
DELETE  = 3
EDIT  = 1
The various type of permissions.
SEARCH  = 5
VIEW  = 2

Methods

check()  : bool
Given a permission string, check for access requirements
group()  : array<string|int, mixed>
Get all the groups the user has access to for the given operation.
groupPermission()  : bool
Check if the user has access to this group for operation $type
whereClause()  : string
Get the permissioned where clause for the user.

Constants

ALL

public mixed ALL = 6

CREATE

public mixed CREATE = 4

DELETE

public mixed DELETE = 3

EDIT

The various type of permissions.

public int EDIT = 1
public mixed SEARCH = 5

VIEW

public mixed VIEW = 2

Methods

check()

Given a permission string, check for access requirements

public static check(string $str[, int|null $contactID = NULL ]) : bool
Parameters
$str : string

The permission to check.

$contactID : int|null = NULL

The contactID for whom the check is made.

Return values
bool —

true if yes, else false

group()

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

public static group(int $type[, int|null $contactID = NULL ][, string $tableName = 'civicrm_group' ][, array<string|int, mixed>|null $allGroups = NULL ][, array<string|int, mixed> $includedGroups = [] ]) : array<string|int, mixed>
Parameters
$type : int

The type of permission needed.

$contactID : int|null = NULL

The contactID for whom the check is made.

$tableName : string = 'civicrm_group'
$allGroups : array<string|int, mixed>|null = NULL
$includedGroups : array<string|int, mixed> = []
Return values
array<string|int, mixed> —

the ids of the groups for which the user has permissions

groupPermission()

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

public static groupPermission(int $type, int $groupID[, int|null $contactID = NULL ][, string $tableName = 'civicrm_group' ][, array<string|int, mixed>|null $allGroups = NULL ][, array<string|int, mixed>|null $includedGroups = NULL ]) : bool
Parameters
$type : int

The type of permission needed.

$groupID : int
$contactID : int|null = NULL

The contactID for whom the check is made.

$tableName : string = 'civicrm_group'
$allGroups : array<string|int, mixed>|null = NULL
$includedGroups : array<string|int, mixed>|null = NULL
Return values
bool

whereClause()

Get the permissioned where clause for the user.

public static whereClause(int $type, array<string|int, mixed> &$tables, array<string|int, mixed> &$whereTables[, int|null $contactID = NULL ][, bool $onlyDeleted = FALSE ][, bool $skipDeleteClause = FALSE ][, bool $skipOwnContactClause = FALSE ]) : string
Parameters
$type : int

The type of permission needed.

$tables : array<string|int, mixed>

(reference ) add the tables that are needed for the select clause.

$whereTables : array<string|int, mixed>

(reference ) add the tables that are needed for the where clause.

$contactID : int|null = NULL

The contactID for whom the check is made.

$onlyDeleted : bool = FALSE

Whether to include only deleted contacts.

$skipDeleteClause : bool = FALSE

Don't add delete clause if this is true,. this means it is handled by generating query

$skipOwnContactClause : bool = FALSE

Do not add 'OR contact_id = $userID' to the where clause. This is a hideously inefficient query and should be avoided wherever possible.

Return values
string —

the group where clause for this user


        
On this page

Search results