function pmteam_node_access_records in Drupal PM (Project Management) 7
Implements hook_node_access_records().
File
- pmteam/
pmteam.module, line 460 - Functionality for the Project Management Team module Organized into the following sections:
Code
function pmteam_node_access_records($node) {
if (empty($node->status)) {
// Lets Drupal take care of permission to unpublished nodes.
return array();
}
$type = is_string($node) ? $node : $node->type;
$grants = array();
if ($type == 'pmteam') {
// Project Management Team: view all
$grants[] = array(
'realm' => 'pmteam_view_all',
'gid' => 0,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
// Project Management Team: view own
$grants[] = array(
'realm' => 'pmteam_view_own',
'gid' => $node->uid,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
// Project Management Team: view belonged
$grants[] = array(
'realm' => 'pmteam_view_if_belonged',
'gid' => $node->nid,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
// Project Management Team: edit all
$grants[] = array(
'realm' => 'pmteam_update_all',
'gid' => 0,
'grant_view' => 0,
'grant_update' => 1,
'grant_delete' => 0,
'priority' => 0,
);
// Project Management Team: edit own
$grants[] = array(
'realm' => 'pmteam_update_own',
'gid' => $node->uid,
'grant_view' => 0,
'grant_update' => 1,
'grant_delete' => 0,
'priority' => 0,
);
// Project Management Team: edit belonged
$grants[] = array(
'realm' => 'pmteam_update_if_belonged',
'gid' => $node->nid,
'grant_view' => 0,
'grant_update' => 1,
'grant_delete' => 0,
'priority' => 0,
);
// Project Management Team: delete all
$grants[] = array(
'realm' => 'pmteam_delete_all',
'gid' => 0,
'grant_view' => 0,
'grant_update' => 0,
'grant_delete' => 1,
'priority' => 0,
);
// Project Management Team: delete own
$grants[] = array(
'realm' => 'pmteam_delete_own',
'gid' => $node->uid,
'grant_view' => 0,
'grant_update' => 0,
'grant_delete' => 1,
'priority' => 0,
);
// Project Management Team: delete belonged
$grants[] = array(
'realm' => 'pmteam_delete_if_belonged',
'gid' => $node->nid,
'grant_view' => 0,
'grant_update' => 0,
'grant_delete' => 1,
'priority' => 0,
);
}
return $grants;
}