From bc9cbefa307cac21cb276ff94bb615db5c80e743 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Mon, 23 Jan 2006 08:06:43 +0000
Subject: [PATCH] - Patch #45729 by markus, jvandyk, moshe: fixed problem with
 permission checking.

---
 modules/user.module      | 2 +-
 modules/user/user.module | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/user.module b/modules/user.module
index 12405d28515c..0a9d131e6b9a 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -337,7 +337,7 @@ function user_access($string, $account = NULL) {
 
   // To reduce the number of SQL queries, we cache the user's permissions
   // in a static variable.
-  if (!isset($perm[$account->uid]) && count($user->roles)) {
+  if (!isset($perm[$account->uid])) {
     $result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
 
     $perm[$account->uid] = '';
diff --git a/modules/user/user.module b/modules/user/user.module
index 12405d28515c..0a9d131e6b9a 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -337,7 +337,7 @@ function user_access($string, $account = NULL) {
 
   // To reduce the number of SQL queries, we cache the user's permissions
   // in a static variable.
-  if (!isset($perm[$account->uid]) && count($user->roles)) {
+  if (!isset($perm[$account->uid])) {
     $result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
 
     $perm[$account->uid] = '';
-- 
GitLab