function crm_core_relationship_permission in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_relationship/crm_core_relationship.module \crm_core_relationship_permission()
- 8.2 modules/crm_core_relationship/crm_core_relationship.module \crm_core_relationship_permission()
- 7 modules/crm_core_relationship/crm_core_relationship.module \crm_core_relationship_permission()
Implements hook_permission().
File
- modules/
crm_core_relationship/ crm_core_relationship.module, line 21 - CRM Core Relationship, handles relationship logic and API.
Code
function crm_core_relationship_permission() {
$permissions = [];
// Administration permission.
$permissions['administer contact relationship types'] = [
'title' => t('Administer contact relationship types'),
'description' => t('Allows user to create/edit/delete any contact relationship types'),
'restrict access' => TRUE,
];
// Static permissions.
$permissions['create relation entities of any contact relationship'] = [
'title' => t('Create Any Contact Relationships'),
'description' => t('Allows user to create any CRM relationship.'),
];
$permissions['view relation entities of any contact relationship'] = [
'title' => t('View Any Contact Relationships'),
'description' => t('Allows user to view any CRM relationship'),
];
$permissions['edit relation entities of any contact relationship'] = [
'title' => t('Edit Any Contact Relationships'),
'description' => t('Allows user to edit any CRM relationship'),
];
// Per bundle permissions.
$relationships = crm_core_relationship_get_relationships();
$entity_info = [
'permission labels' => [
'singular' => t('relationship'),
'plural' => t('relationships'),
],
];
foreach ($relationships as $type => $info) {
$info = (array) $info;
$permissions += crm_core_bundle_access_permissions($type, $info, 'relation', $entity_info);
}
return $permissions;
}