From e291cf00ff7b751d6889d4c35e7f7bb30bb5a6c0 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Tue, 13 Oct 2026 06:02:54 -0400 Subject: [PATCH] =?UTF-8?q?--author:scott--date:20261013--for:=E3=80=90?= =?UTF-8?q?=E5=AE=89=E5=85=A8=20GHSA-9xxr-rh33-qr3f/GHSA-wmx3-2wgf-9fw3/GH?= =?UTF-8?q?SA-pjwf-2w2c-xc23=E3=80=91=E8=AE=BE=E7=BD=AE=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E8=B4=9F=E8=B4=A3=E4=BA=BA=E3=80=81=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=A8=E6=88=B7=E5=8F=AA=E5=85=81=E8=AE=B8admin?= =?UTF-8?q?=E6=88=96=E5=BD=93=E5=89=8D=E7=A7=9F=E6=88=B7=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=93=8D=E4=BD=9C=E6=9C=AC=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../system/controller/SysUserController.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java index d8a9afb1f..16a0d0cb3 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java @@ -1957,8 +1957,9 @@ public class SysUserController { */ @PutMapping("/batchEditUsers") public Result batchEditUsers(@RequestBody JSONObject jsonObject) { - //update-begin---author:scott ---date:20261013 for:【安全 GHSA-pjwf-2w2c-xc23/GHSA-4w9p-7gw3-q7v4】批量修改用户部门职位须为用户管理员或当前租户管理员,且租户管理员只能修改本租户用户----------- - if (!SecurityUtils.getSubject().hasRole("admin") && !SecurityUtils.getSubject().isPermitted("system:user:edit")) { + //update-begin---author:scott ---date:20261013 for:【安全 GHSA-pjwf-2w2c-xc23/GHSA-4w9p-7gw3-q7v4】批量修改用户部门职位须为admin或当前租户管理员,且租户管理员只能修改本租户用户----------- + // 敲敲云SaaS模式下所有用户默认拥有test角色权限,不能用权限码放行,只放行admin + if (!SecurityUtils.getSubject().hasRole("admin")) { String tenantId = TenantContext.getTenant(); if (oConvertUtils.isEmpty(tenantId)) { return Result.error("无权限执行此操作"); @@ -1971,7 +1972,7 @@ public class SysUserController { return Result.error("只能修改当前租户下的用户"); } } - //update-end---author:scott ---date:20261013 for:【安全 GHSA-pjwf-2w2c-xc23/GHSA-4w9p-7gw3-q7v4】批量修改用户部门职位须为用户管理员或当前租户管理员,且租户管理员只能修改本租户用户----------- + //update-end---author:scott ---date:20261013 for:【安全 GHSA-pjwf-2w2c-xc23/GHSA-4w9p-7gw3-q7v4】批量修改用户部门职位须为admin或当前租户管理员,且租户管理员只能修改本租户用户----------- Result result = new Result(); try { sysUserService.batchEditUsers(jsonObject); @@ -2024,6 +2025,24 @@ public class SysUserController { */ @PutMapping("/changeDepartChargePerson") public Result changeDepartChargePerson(@RequestBody JSONObject json) { + //update-begin---author:scott ---date:20261013 for:【安全 GHSA-9xxr-rh33-qr3f】设置部门负责人须为admin或当前租户管理员,且租户管理员只能设置本租户的部门和用户----------- + // 敲敲云SaaS模式下所有用户默认拥有test角色权限(含system:depart:edit),不能用权限码放行,只放行admin + if (!SecurityUtils.getSubject().hasRole("admin")) { + String tenantId = TenantContext.getTenant(); + if (oConvertUtils.isEmpty(tenantId)) { + return Result.error("无权限执行此操作"); + } + // 非当前租户的组织账户管理员或超级管理员时抛出异常 + sysTenantPackService.izHaveManageUserAuth(tenantId); + SysDepart depart = sysDepartService.getById(json.getString("departId")); + // 开启系统租户隔离时,部门须属于当前租户(未开启时部门不区分租户) + boolean departInTenant = depart != null && (!MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL || tenantId.equals(String.valueOf(depart.getTenantId()))); + List tenantUserIds = userTenantService.getUserIdsByTenantId(Integer.valueOf(tenantId)); + if (!departInTenant || !tenantUserIds.contains(json.getString("userId"))) { + return Result.error("只能设置当前租户下的部门负责人"); + } + } + //update-end---author:scott ---date:20261013 for:【安全 GHSA-9xxr-rh33-qr3f】设置部门负责人须为admin或当前租户管理员,且租户管理员只能设置本租户的部门和用户----------- sysUserService.changeDepartChargePerson(json); return Result.ok(); }