You are here

function workbench_access_in_tree in Workbench Access 7

Check to see if an access check is in a given hierarchy.

Parameters

$access_ids: The access_id array for this node.

$account_access: The access rules for the user performing the action.

Return value

The id of the rule that grants access, or FALSE if none do.

See also

workbench_access_check()

1 call to workbench_access_in_tree()
workbench_access_check in ./workbench_access.module
Check to see if a user can access the node for this operation.

File

./workbench_access.module, line 475
Workbench Access module file.

Code

function workbench_access_in_tree($access_id, $account_access) {

  // Simple equivalence check. If this passes, no need for complexity.
  if (isset($account_access[$access_id])) {
    return $access_id;
  }
  $tree = workbench_access_get_access_tree(array_keys($account_access));
  foreach ($tree as $id => $info) {
    $data = array_flip($info);
    if (isset($data[$access_id])) {
      return $id;
    }
  }
  return FALSE;
}