From 89680d375411ccdda62347cbcb1e07808daa8817 Mon Sep 17 00:00:00 2001 From: walkor Date: Sat, 4 Mar 2023 19:11:44 +0800 Subject: [PATCH 1/2] For pullRequest 19 For https://github.com/webman-php/admin/pull/19 --- src/plugin/admin/app/middleware/AccessControl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugin/admin/app/middleware/AccessControl.php b/src/plugin/admin/app/middleware/AccessControl.php index 1aebaa6..38fa701 100644 --- a/src/plugin/admin/app/middleware/AccessControl.php +++ b/src/plugin/admin/app/middleware/AccessControl.php @@ -37,6 +37,7 @@ class AccessControl implements MiddlewareInterface EOF ); } else { + $request->plugin = 'admin'; $response = view('common/error/403')->withStatus(403); } } @@ -49,4 +50,4 @@ EOF } -} \ No newline at end of file +} From f128cb7e6d0fefa6cb34733421c44a9a377f082a Mon Sep 17 00:00:00 2001 From: walkor Date: Sat, 4 Mar 2023 19:36:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=92=8C=E5=AD=90?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E4=B8=80=E8=B5=B7=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #20 --- src/plugin/admin/app/controller/RoleController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin/admin/app/controller/RoleController.php b/src/plugin/admin/app/controller/RoleController.php index 0470de8..2c466ed 100644 --- a/src/plugin/admin/app/controller/RoleController.php +++ b/src/plugin/admin/app/controller/RoleController.php @@ -171,6 +171,11 @@ class RoleController extends Crud if (!Auth::isSupperAdmin() && array_diff($ids, Auth::getScopeRoleIds())) { return $this->json(1, '无删除权限'); } + $tree = new Tree(Role::get()); + $descendants = $tree->getDescendant($ids); + if ($descendants) { + $ids = array_merge($ids, array_column($descendants, 'id')); + } $this->doDelete($ids); return $this->json(0); }