summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--acl.module15
2 files changed, 13 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ef80542..2ee374a 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,7 @@ CHANGELOG for ACL for Drupal 6
acl 6.x-1.x-dev:
Porting to D6:
+ - Improve hook_node_access_explain().
- #135687: Implement grant priority.
- #229451: Allow acl_edit_form() without pre-created acl_id.
- Implement hook_user('delete') and remove orphaned {acl_user} records.
diff --git a/acl.module b/acl.module
index 861ee8a..fa13d44 100644
--- a/acl.module
+++ b/acl.module
@@ -277,14 +277,23 @@ function acl_node_access_explain($row) {
static $interpretations = array();
if ($row->realm == 'acl') {
if (!isset($interpretations[$row->gid])) {
- $acl = db_fetch_object(db_query("SELECT * from {acl} WHERE acl_id = %d", $row->gid));
- $interpretations[$row->gid] = $acl->module .'/'. $acl->name;
+ $acl = db_fetch_object(db_query("SELECT * FROM {acl} WHERE acl_id = %d", $row->gid));
$result = db_query("SELECT u.name FROM {acl_user} au, {users} u WHERE au.acl_id = %d AND au.uid = u.uid", $row->gid);
while ($user = db_fetch_object($result)) {
$users[] = $user->name;
}
if (isset($users)) {
- $interpretations[$row->gid] .= ': '. implode(', ', $users);
+ $interpretations[$row->gid] = $acl->module .'/'. $acl->name .': '. implode(', ', $users);
+ }
+ elseif ($row->gid == 0) {
+ $result = db_query("SELECT an.acl_id, a.module, a.name FROM {acl_node} an JOIN {acl} a ON an.acl_id = a.acl_id LEFT JOIN {acl_user} au ON a.acl_id = au.acl_id WHERE an.nid = %d AND au.uid IS NULL", $row->nid);
+ while ($acl = db_fetch_object($result)) {
+ $rows[] = $acl->acl_id .': '. $acl->module .'/'. $acl->name;
+ }
+ if (!empty($rows)) {
+ return implode('<br />', $rows);
+ }
+ return 'No access via ACL.';
}
else {
$interpretations[$row->gid] .= ': no users!';