class CRM_Core_Permission_Drupal extends CRM_Core_Permission_DrupalBase

Properties

$permissions from CRM_Core_Permission_Base
protected boolean $_viewAdminUser Is this user someone with access for the entire system.
protected $_editAdminUser
protected boolean $_viewPermission Am in in view permission or edit permission?
protected $_editPermission
protected array $_viewPermissionedGroups The current set of permissioned groups for the user.
protected $_editPermissionedGroups

Methods

NULL|string
translatePermission(string $perm, string $nativePrefix, array $map)

Translate permission.

string
getPermission()

Get the current permission of this user.

string
whereClause(int $type, array $tables, array $whereTables)

Get the permissioned where clause for the user.

string
getPermissionedStaticGroupClause(int $type, array $tables, array $whereTables)

Get the permissioned where clause for the user when trying to see groups.

array
group(string $groupType = NULL, bool $excludeHidden = TRUE)

Get all groups from database, filtered by permissions for this user

string
groupClause(int $type, array $tables, array $whereTables)

Get group clause for this user. The group Clause filters the list of groups that the user is permitted to see in a group listing.

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

Given a permission string, check for access requirements

bool
checkGroupRole(array $array)

Given a roles array, check for access requirements

permissionEmails(string $permissionName)

Get all the contact emails for users that have a specific permission.

roleEmails(string $roleName)

Get all the contact emails for users that have a specific role.

bool
isModulePermissionSupported()

No description

upgradePermissions(array $permissions)

No description

static array
getModulePermissions($module)

Get the permissions defined in the hook_civicrm_permission implementation of the given module.

array
getAllModulePermissions(bool $descriptions = FALSE)

Get the permissions defined in the hook_civicrm_permission implementation in all enabled CiviCRM module extensions.

string
getContactEmails($uids)

No description

Details

NULL|string translatePermission(string $perm, string $nativePrefix, array $map)

Translate permission.

Parameters

string $perm Permission string e.g "administer CiviCRM", "cms:access user record", "Drupal:administer content", "Joomla:action:com_asset"
string $nativePrefix
array $map Array($portableName => $nativeName).

Return Value

NULL|string a permission name

string getPermission()

Get the current permission of this user.

Return Value

string the permission of the user (edit or view or null)

string whereClause(int $type, array $tables, array $whereTables)

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.

Return Value

string the group where clause for this user

string getPermissionedStaticGroupClause(int $type, array $tables, array $whereTables)

Get the permissioned where clause for the user when trying to see groups.

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.

Return Value

string the group where clause for this user

array group(string $groupType = NULL, bool $excludeHidden = TRUE)

Get all groups from database, filtered by permissions for this user

Parameters

string $groupType Type of group(Access/Mailing).
bool $excludeHidden exclude hidden groups.

Return Value

array array reference of all groups.

string groupClause(int $type, array $tables, array $whereTables)

Get group clause for this user. The group Clause filters the list of groups that the user is permitted to see in a group listing.

For example it will filter both the list on the 'Manage Groups' page and on the contact 'Groups' tab

the aclGroup hook & configured ACLs contribute to this data. If the contact is allowed to see all contacts the function will return ( 1 )

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.

Return Value

string the group where clause for this user

at line 76
check(string $str, int $contactID = NULL)

Given a permission string, check for access requirements

Parameters

string $str The permission to check.
int $contactID

at line 102
bool checkGroupRole(array $array)

Given a roles array, check for access requirements

Parameters

array $array The roles to check.

Return Value

bool true if yes, else false

at line 144
permissionEmails(string $permissionName)

Get all the contact emails for users that have a specific permission.

Parameters

string $permissionName Name of the permission we are interested in.

roleEmails(string $roleName)

Get all the contact emails for users that have a specific role.

Parameters

string $roleName Name of the role we are interested in.

at line 118
bool isModulePermissionSupported()

Return Value

bool

at line 125
upgradePermissions(array $permissions)

Parameters

array $permissions Same format as CRM_Core_Permission::getCorePermissions().

static array getModulePermissions($module)

Get the permissions defined in the hook_civicrm_permission implementation of the given module.

Note: At time of writing, this is only used with native extension-modules, so there's one, predictable calling convention (regardless of CMS).

Parameters

$module

Return Value

array Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().

See also

CRM_Core_Permission::getCorePermissions

array getAllModulePermissions(bool $descriptions = FALSE)

Get the permissions defined in the hook_civicrm_permission implementation in all enabled CiviCRM module extensions.

Parameters

bool $descriptions

Return Value

array Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().

string getContactEmails($uids)

Parameters

$uids

Return Value

string