Browse Source

修复超级管理员无法在列表查看超级管理员的BUG

Karson 8 years ago
parent
commit
0ac468d85c
1 changed files with 15 additions and 7 deletions
  1. 15 7
      application/admin/library/Auth.php

+ 15 - 7
application/admin/library/Auth.php

@@ -289,16 +289,24 @@ class Auth extends \fast\Auth
      */
     public function getChildrenAdminIds($withself = false)
     {
-        $groupIds = $this->getChildrenGroupIds(false);
         $childrenAdminIds = [];
-        $authGroupList = model('AuthGroupAccess')
-                ->field('uid,group_id')
-                ->where('group_id', 'in', $groupIds)
-                ->select();
+        if (!$this->isSuperAdmin())
+        {
+            $groupIds = $this->getChildrenGroupIds(false);
+            $authGroupList = model('AuthGroupAccess')
+                    ->field('uid,group_id')
+                    ->where('group_id', 'in', $groupIds)
+                    ->select();
 
-        foreach ($authGroupList as $k => $v)
+            foreach ($authGroupList as $k => $v)
+            {
+                $childrenAdminIds[] = $v['uid'];
+            }
+        }
+        else
         {
-            $childrenAdminIds[] = $v['uid'];
+            //超级管理员拥有所有人的权限
+            $childrenAdminIds = Admin::column('id');
         }
         if ($withself)
         {