if ($op != 'create' && $node->nid && $node->status) { $grants_sql = node_access_grants_sql($op, NULL, $user->uid, $node->status); // If the return value is FALSE, then the node status is unpublished and // none of the grants requested an access check be run. In which case, // we should fall through to the final 'if' statement. if ($grants_sql !== FALSE) { if (!empty($grants_sql)) { $grants_sql .= ' AND'; } $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql grant_$op >= 1"; $result = db_query($sql, $node->nid); return (db_result($result)); } }
Apparently, in 6.x the $account object is used. But, our code is still expecting only the $accunt->uid.
node_access_grants($op, $account = NULL)
Nothing to change. Although this now requires $account object instead of $account->uid (in Drupal 5.x)
node_access_view_all_nodes()
$grants_sql = node_access_grants_sql('view');
node_access_grants_sql
This is our own custom code, although I do need to modify in order to get the $account object for calling node_access_grants(). Previously, I only needed the $account->uid.
$rules = node_access_grants($op, $account);
node_multinode($theme = NULL)
This is our own custom code, although I do need to modify in order to get the $account object for calling node_access_grants(). Previously, I only needed the $account->uid.
$mrules = node_access_grants($op, $account);
theme_node_multinode($form)
node_multinode_submit($form_id, $form_values)
This has to change to:
Received suggestion. Created tac_lite_multinode.module: http://www.scbbs.com/node/382#comment-843 and installed. This module logically should grant tac_lite "view" access to all nodes that tac_lite doesn't care about. This way, when we AND tac_lite realm, users will see nodes that they otherwise should see that don't have tac_lite terms.
Went to Multinode user interface and ANDed tac_lite realm.
Anonymous user can see Test Group 01 and Public Test Page for Test Group 01.
Logged in as user test02. This user can see everything except Test Page in Test Group 01: http://test.scbbs.com/node/8
Made user test01 a "Group Contributor". Logged in as this user. He can see Test Page in Test Group 01 (Group Contributors Only): http://test.scbbs.com/node/8 as expected.
Have tested with anonymous and authenticated group members. Need to test with authenticated user who is not a member of group.
Removing user test01 from Test Group 01. He can now only see Public Test Page for Test Group 01: http://test.scbbs.com/node/6. This is as it should be.
Initial testing seems to be OK. Needed tac_lite_multinode.module for tac_lite node grants to work correctly.
Comments
Multinode Access Patch 6.x Upgrade
Patch to add Multinode Access UI to node.module. Patch is named:
Upgrading the patch to 6.x. Here are the functions where updating needs to take place:
Here are the details:
$items['admin/content/multinode'] = array(
'title' => t('Multinode user interface'),
'description' => t('Interface for configuring multiple node access.'),
'page callback' => 'drupal_get_form',
'page arguments' => array('node_multinode'),
'access arguments' => user_access('administer nodes'),
'type' => MENU_NORMAL_ITEM
);
if ($op != 'create' && $node->nid && $node->status) {
$grants_sql = node_access_grants_sql($op, NULL, $user->uid, $node->status);
// If the return value is FALSE, then the node status is unpublished and
// none of the grants requested an access check be run. In which case,
// we should fall through to the final 'if' statement.
if ($grants_sql !== FALSE) {
if (!empty($grants_sql)) {
$grants_sql .= ' AND';
}
$sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql grant_$op >= 1";
$result = db_query($sql, $node->nid);
return (db_result($result));
}
}
$grants_sql = node_access_grants_sql('view', $node_access_alias, $account->uid);
Note that in original patch this was:
$grants_sql = node_access_grants_sql('view', $node_access_alias, $uid);
Apparently, in 6.x the $account object is used. But, our code is still expecting only the $accunt->uid.
Nothing to change. Although this now requires $account object instead of $account->uid (in Drupal 5.x)
$grants_sql = node_access_grants_sql('view');
This is our own custom code, although I do need to modify in order to get the $account object for calling node_access_grants(). Previously, I only needed the $account->uid.
$rules = node_access_grants($op, $account);
This is our own custom code, although I do need to modify in order to get the $account object for calling node_access_grants(). Previously, I only needed the $account->uid.
$mrules = node_access_grants($op, $account);
node_multinode_submit($form, $form_state)
as per Drupal 6.x upgrade.
So, this code:
foreach ($form_values as $block) {
becomes this:
foreach ($form_state['values'] as $block) {
System Install Patch (for Multinode Access 6.x Upgrade)
Need to modify system.install module to install multinode_access table.
This patch is called: system.install.multinode.patch.
system.install functions modified:
Code details:
Create multinode_access table. Not sure what number should go in function name.
Testing 6.x Multinode Access Code
warning: Invalid argument supplied for foreach() in /var/www/html/websites/drupal/test/includes/menu.inc on line 258
Must be from menu settings or the $account issue.
Testing with 6.x tac_lite
It was suggested that I test 6.x multinode access with 6.x tac_lite.module which is current head version: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/tac_lite/
Initial testing seems to be OK. Needed tac_lite_multinode.module for tac_lite node grants to work correctly.