function pm_permission_permission_per_bundle in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 includes/pm.permission.inc \pm_permission_permission_per_bundle()
Creates an array of permission name for the given node bundle.
Parameters
string $bundle_name: Node bundle name.
Return value
array Array equivalent to the return of hook_permission().
1 call to pm_permission_permission_per_bundle()
- pm_permission in ./
pm.module - Implements hook_permission().
File
- includes/
pm.permission.inc, line 198 - Main module file for the pm_permission module.
Code
function pm_permission_permission_per_bundle($bundle_name) {
$name = node_type_get_name($bundle_name);
$bundle_name = check_plain($bundle_name);
$permissions = array();
if (!variable_get('node_permissions_' . $bundle_name, 1)) {
$permissions += _pm_permission_permission_default($bundle_name, $name);
}
if (module_exists('pmorganization')) {
if (_pm_permission_get_field_name($bundle_name, 'parent') or $bundle_name == 'pmorganization') {
$permissions += _pm_permission_permission_belonged($bundle_name, $name, 'Organization');
}
}
if (module_exists('pmproject')) {
if (_pm_permission_get_field_name($bundle_name, 'pm')) {
$permissions += _pm_permission_permission_assigned($bundle_name, $name, 'Project Manager');
}
}
if (_pm_permission_get_field_name($bundle_name, 'assigned')) {
$permissions += _pm_permission_permission_assigned($bundle_name, $name, 'Assigned');
}
return $permissions;
}