From 3728bd2068f33b276b29fe0fb24d182c06c0d5ab Mon Sep 17 00:00:00 2001 From: JaguarJack <82664165@qq.com> Date: Tue, 31 Aug 2021 14:16:13 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=20=E8=B6=85=E7=AE=A1=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=85=A8=E9=83=A8=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/permissions/controller/Role.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/catch/permissions/controller/Role.php b/catch/permissions/controller/Role.php index 5c386c9..7552f1b 100644 --- a/catch/permissions/controller/Role.php +++ b/catch/permissions/controller/Role.php @@ -7,6 +7,7 @@ use catcher\base\CatchRequest as Request; use catcher\base\CatchController; use catcher\CatchResponse; use catcher\exceptions\FailedException; +use catcher\Utils; use think\response\Json; use catchAdmin\permissions\model\Roles as RoleModel; @@ -163,9 +164,16 @@ class Role extends CatchController * @time 2021年07月29日 * @param $id * @return Json + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\db\exception\DataNotFoundException */ public function getPermissions($id): Json { + if (Utils::isSuperAdmin()) { + return CatchResponse::success(Permissions::field(['id', 'parent_id', 'permission_name'])->select()->toTree()); + } + return CatchResponse::success( Permissions::whereIn('id', $this->role->findBy($id)->getPermissions()->column('id')) ->field(['id', 'parent_id', 'permission_name'])