function pmnote_node_grants in Drupal PM (Project Management) 7
Implements hook_node_grants().
File
- pmnote/
pmnote.module, line 570 - Functions for the PM Note module.
Code
function pmnote_node_grants($account, $op) {
if (module_exists('pmperson')) {
_pmperson_user_load($account);
}
$grants = array();
switch ($op) {
case 'view':
if (user_access('Project Management note: view all', $account)) {
$grants['pmnote_view_all'] = array(
0,
);
}
if (user_access('Project Management note: view own', $account)) {
$grants['pmnote_view_own'] = array(
$account->uid,
);
}
if (user_access('Project Management note: view of user organization', $account) and !empty($account->pmorganization_nid)) {
$grants['pmnote_view_if_user_organization'] = array(
$account->pmorganization_nid,
);
}
break;
case 'update':
if (user_access('Project Management note: edit all', $account)) {
$grants['pmnote_update_all'] = array(
0,
);
}
if (user_access('Project Management note: edit own', $account)) {
$grants['pmnote_update_own'] = array(
$account->uid,
);
}
if (user_access('Project Management note: edit of user organization', $account) and !empty($account->pmorganization_nid)) {
$grants['pmnote_update_if_user_organization'] = array(
$account->pmorganization_nid,
);
}
break;
case 'delete':
if (user_access('Project Management note: delete all', $account)) {
$grants['pmnote_delete_all'] = array(
0,
);
}
if (user_access('Project Management note: delete own', $account)) {
$grants['pmnote_delete_own'] = array(
$account->uid,
);
}
if (user_access('Project Management note: delete of user organization', $account) and !empty($account->pmorganization_nid)) {
$grants['pmnote_delete_if_user_organization'] = array(
$account->pmorganization_nid,
);
}
break;
}
return $grants;
}