From f128cb7e6d0fefa6cb34733421c44a9a377f082a Mon Sep 17 00:00:00 2001 From: walkor Date: Sat, 4 Mar 2023 19:36:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=92=8C=E5=AD=90=E8=A7=92?= =?UTF-8?q?=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); }