fix: 机构管理员可修改本机构用户信息(modify_org_user_info双档权限+机构范围校验),禁改超管;isSuperior空值防护
This commit is contained in:
@@ -150,7 +150,7 @@ public class UserContextHolder {
|
||||
*/
|
||||
public static boolean isSuperior() {
|
||||
IUserDetail userDTO = getLoginUser();
|
||||
return userDTO != null && userDTO.getSupeiror();
|
||||
return userDTO != null && Boolean.TRUE.equals(userDTO.getSupeiror());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -925,11 +925,15 @@ public class UserServiceImpl implements UserService {
|
||||
@Transactional
|
||||
@AutoUnLock
|
||||
public Boolean modifyOrgUserInfo(OrgUserEditDTO orgUserEditDTO) {
|
||||
Assert.isTrue(UserContextHolder.isSuperior(), "当前用户无操作权限");
|
||||
// 平台超管可修改全部用户,机构管理员仅可修改本机构用户
|
||||
Assert.isTrue(UserContextHolder.isSuperior() || UserContextHolder.isAdministrator(),
|
||||
"当前用户无操作权限");
|
||||
ValidateUtils.validateBiz(orgUserEditDTO);
|
||||
Long userId = orgUserEditDTO.getId();
|
||||
this.checkOrgScopeOfOperateUser(userId);
|
||||
UserDTO userDto = findUserDTO(UserQueryDTO.builder().id(userId).build());
|
||||
Assert.notNull(userDto, userId + "-用户不可用");
|
||||
Assert.isTrue(!Boolean.TRUE.equals(userDto.getSupeiror()), "不能修改超级管理员账号");
|
||||
User user = new User();
|
||||
user.setId(userId);
|
||||
//校验
|
||||
|
||||
Reference in New Issue
Block a user