function _pm_permission_grants_default in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 includes/pm.permission.inc \_pm_permission_grants_default()
Generate default grants similar to drupal core.
1 call to _pm_permission_grants_default()
- pm_node_access_records in ./
pm.module - Implements hook_node_access_records().
File
- includes/
pm.permission.inc, line 357 - Main module file for the pm_permission module.
Code
function _pm_permission_grants_default($node, $type) {
// PM permission $type: view all.
$grants[] = array(
'realm' => "pm_permission_{$type}_view_all",
'gid' => 0,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
// PM permission $type: view own.
$grants[] = array(
'realm' => "pm_permission_{$type}_view_own",
'gid' => $node->uid,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
// PM permission $type: update all.
$grants[] = array(
'realm' => "pm_permission_{$type}_update_all",
'gid' => 0,
'grant_view' => 0,
'grant_update' => 1,
'grant_delete' => 0,
'priority' => 0,
);
// PM permission $type: update own.
$grants[] = array(
'realm' => "pm_permission_{$type}_update_own",
'gid' => $node->uid,
'grant_view' => 0,
'grant_update' => 1,
'grant_delete' => 0,
'priority' => 0,
);
// PM permission $type: delete all.
$grants[] = array(
'realm' => "pm_permission_{$type}_delete_all",
'gid' => 0,
'grant_view' => 0,
'grant_update' => 0,
'grant_delete' => 1,
'priority' => 0,
);
// PM permission $type: delete own.
$grants[] = array(
'realm' => "pm_permission_{$type}_delete_own",
'gid' => $node->uid,
'grant_view' => 0,
'grant_update' => 0,
'grant_delete' => 1,
'priority' => 0,
);
return $grants;
}