0) { return true; }else{ return false; } } /* is_tree_allowed - determines whether the current user is allowed to view a certain graph tree @arg $tree_id - (int) the ID of the graph tree to check permissions for @returns - (bool) whether the current user is allowed the view the specified graph tree or not */ function is_tree_allowed($tree_id) { $current_user = db_fetch_row("select policy_trees from user_auth where id=" . $_SESSION["sess_user_id"]); $trees = db_fetch_assoc("select user_id from user_auth_perms where user_id=" . $_SESSION["sess_user_id"] . " and type=2 and item_id=$tree_id"); /* policy == allow AND matches = DENY */ if ((sizeof($trees) > 0) && ($current_user["policy_trees"] == "1")) { return false; /* policy == deny AND matches = ALLOW */ }elseif ((sizeof($trees) > 0) && ($current_user["policy_trees"] == "2")) { return true; /* policy == allow AND no matches = ALLOW */ }elseif ((sizeof($trees) == 0) && ($current_user["policy_trees"] == "1")) { return true; /* policy == deny AND no matches = DENY */ }elseif ((sizeof($trees) == 0) && ($current_user["policy_trees"] == "2")) { return false; } } ?>