Attempting to get OG/TAC to work together, drupal 5.10

installed og user roles
installed the patch, enabled TAC and OG Access Control modules
enabled TAC in OG user roles
in "Configure Multinode UI" i failed to locate "og_access"

instead, these 5 headings appear:
all
og_admin
og_public
og_subscriber
term_access

what could be the issue?

Comments

KrisBulman’s picture

Also installed the user.module patch included successfully and enabled the cache clearing option, thinking that may have some effect, but no dice.

Checked my drupal db: "og_users_roles" does exist with 4 fields (ogr_id, uid, rid, gid) but contains no data.

somebodysysop’s picture

OK, I re-visited the code. I've finally figured this out. Bear with me as I try to explain.

This code in the multinode_access patch is designed to get all available realms from all installed modules:

+  // Get all rule realms from node_access table.
+  $result = db_query("SELECT DISTINCT realm FROM {node_access}");
+   while ($row = db_fetch_object($result)) {
+    $rules[] = $row->realm;
+   }    
+
+  // Get all rule realms from modules.  User doing this should have grants in all modules affected.
+  $op = 'view';
+  $mrules = node_access_grants($op, $uid);
+  foreach ($mrules as $realm => $grants) {
+    $rules[] = $realm;
+  }

Note that the call to node_access_grants (http://api.drupal.org/api/function/node_access_grants/5) calls the hook_node_grants (http://api.drupal.org/api/function/hook_node_grants/5) hook.

In OGUR, hook_node_grants looks like this:

function og_user_roles_node_grants($account, $op) {
  $array = array('ogr_access' => array());
  $result = db_query("SELECT ogr_id FROM {og_users_roles} WHERE uid = %d", $account->uid);
  while ($row = db_fetch_object($result)) {
    $array['ogr_access'][] = $row->ogr_id;
  }
  return !empty($array['ogr_access']) ? $array : NULL;
}

See the problem? OGUR will only return an ogr_access record for this user *if* the user has an ogr_id record in the og_users_roles table.

So, what does *that* mean? It means that in order to see the ogr_access realm in the multinode access table as user 1, user 1 must belong to at least one group and have at least one OGUR "Member role" configured in that group.

I know, I know. It's a pain. But, I have yet to figure out a better way to realiably get all possible realms from installed modules.

Try doing the above and see if that does the trick. If it does, then we'll add this to the documentation.

Thanks.

KrisBulman’s picture

ok, i configured one OGUR "Member role" in a group for user1, and.. it worked!

thanks, definitely should be added to the documentation

somebodysysop’s picture

Status: Active » Fixed

Will do.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

somebodysysop’s picture

See updated documentation on this here: http://drupal.org/node/281197