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); } diff --git a/src/plugin/admin/app/middleware/AccessControl.php b/src/plugin/admin/app/middleware/AccessControl.php index f9779d8..90b7bfd 100644 --- a/src/plugin/admin/app/middleware/AccessControl.php +++ b/src/plugin/admin/app/middleware/AccessControl.php @@ -42,6 +42,7 @@ class AccessControl implements MiddlewareInterface EOF ); } else { + $request->plugin = 'admin'; $response = view('common/error/403')->withStatus(403); } }