Hello everybody
I'm using OpenAtrium, I think it's 1.0, but not sure.
I need a user with special profile to access a node into a group without being group member. Is that possible?
In short my code gives groups and "my_content_type" a grant called "my_realm" with gid 1.
hook_node_grants() gives each user with "my_special_role" a grant called "my_realm" with gid 1.
As far as I know that should give access user to node, isn't it?
I added this code, but it's not working:
<?php
/<strong>
* hook_node_grants()
*
* It gives "my_realm"grant with gid 1 to all users with my_special_role
*/
function my_module_node_grants($account, $op) {
if (in_array('my_special_role', $account->roles)){
$grants['my_realm'][] = 1;
}
return isset($grants) ? $grants : array();
}
/</strong>
* hook_og_access_grants_alter()
*
* It gives all groups content type "my_realm"grant with gid 1
*/
function my_module_og_access_grants_alter(&$grants, $node){
$grants[] = array (
'realm'=> 'my_realm',
'gid'=> 1,
'grant_view'=> 1,
'grant_update'=> 0,
'grant_delete'=> 0,
'priority'=> 0,
);
return $grants;
}
/**
* hook_node_access_records()
*
* It gives "my_realm" grant with gid 1 to "my_content_type" nodes
*/
function my_module_node_access_records($node){
if ($node->type == 'my_content_type') {
$grants[] = array (
'realm'=> 'my_realm',
'gid'=> 1,
'grant_view'=> 1,
'grant_update'=> 0,
'grant_delete'=> 0,
'priority'=> 0,
);
}
return isset($grants) ? $grants : array();
}
?>
Could you give me a hand on this?
Please, ask if i'm missing some important information.
thank you very much