From 09312d00342f95aac80f5cbbd8d9cede2c52ff07 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 19 Dec 2023 14:10:27 +0800 Subject: [PATCH] * Fix bug where project priv overwrite user priv. --- module/user/model.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/user/model.php b/module/user/model.php index 0e43d39651..5cbb65cfea 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1056,11 +1056,9 @@ class userModel extends model $rights = array(); if($account == 'guest') { - $acl = $this->dao->select('acl')->from(TABLE_GROUP)->where('name')->eq('guest')->fetch('acl'); - $acls = empty($acl) ? array() : json_decode($acl, true); - - $sql = $this->dao->select('module, method')->from(TABLE_GROUP)->alias('t1')->leftJoin(TABLE_GROUPPRIV)->alias('t2') - ->on('t1.id = t2.`group`')->where('t1.name')->eq('guest'); + $acls = $this->dao->select('acl')->from(TABLE_GROUP)->where('name')->eq('guest')->fetch('acl'); + $acls = !empty($acls) ? json_decode($acls, true) : array(); + $sql = $this->dao->select('module, method')->from(TABLE_GROUP)->alias('t1')->leftJoin(TABLE_GROUPPRIV)->alias('t2')->on('t1.id = t2.`group`')->where('t1.name')->eq('guest'); } else { @@ -1070,6 +1068,7 @@ class userModel extends model ->andWhere('t1.vision')->eq($this->config->vision) ->andWhere('t1.role')->ne('projectAdmin') ->andWhere('t1.role')->ne('limited') + ->andWhere('t1.project')->eq(0) ->fetchAll(); /* Init variables. */ @@ -1134,6 +1133,7 @@ class userModel extends model $stmt = $sql->query(); if(!$stmt) return array('rights' => $rights, 'acls' => $acls); + while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { if($row['module'] and $row['method']) $rights[strtolower($row['module'])][strtolower($row['method'])] = true;