--author:scott--date:20261013--for:【安全 GHSA-pjwf-2w2c-xc23/GHSA-4w9p-7gw3-q7v4】batchEditUsers校验用户管理员或当前租户管理员且只能改本租户用户;首页配置导入补权限

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
zhangdaiscott 2026-10-13 04:13:46 -04:00
parent 8acf00ef10
commit 18124943ce
2 changed files with 19 additions and 0 deletions

View File

@ -183,6 +183,7 @@ public class SysRoleIndexController extends JeecgController<SysRoleIndex, ISysRo
* @param response
* @return
*/
@RequiresPermissions("system:roleindex:add")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, SysRoleIndex.class);

View File

@ -109,6 +109,9 @@ public class SysUserController {
@Autowired
private ISysUserTenantService userTenantService;
@Autowired
private ISysTenantPackService sysTenantPackService;
@Autowired
private JeecgRedisClient jeecgRedisClient;
@Autowired
@ -1954,6 +1957,21 @@ public class SysUserController {
*/
@PutMapping("/batchEditUsers")
public Result<SysUser> 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")) {
String tenantId = TenantContext.getTenant();
if (oConvertUtils.isEmpty(tenantId)) {
return Result.error("无权限执行此操作");
}
// 非当前租户的组织账户管理员或超级管理员时抛出异常
sysTenantPackService.izHaveManageUserAuth(tenantId);
List<String> idList = JSONArray.parseArray(jsonObject.getString("userIds"), String.class);
List<String> tenantUserIds = userTenantService.getUserIdsByTenantId(Integer.valueOf(tenantId));
if (idList == null || !tenantUserIds.containsAll(idList)) {
return Result.error("只能修改当前租户下的用户");
}
}
//update-end---author:scott ---date:20261013 for:【安全 GHSA-pjwf-2w2c-xc23/GHSA-4w9p-7gw3-q7v4】批量修改用户部门职位须为用户管理员或当前租户管理员,且租户管理员只能修改本租户用户-----------
Result<SysUser> result = new Result<SysUser>();
try {
sysUserService.batchEditUsers(jsonObject);