fix 修复 普通角色编辑使用内置管理员code越权问题
This commit is contained in:
parent
002a880e8b
commit
635e36a882
@ -79,7 +79,8 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||||||
.like(StringUtils.isNotBlank(bo.getRoleKey()), "r.role_key", bo.getRoleKey())
|
.like(StringUtils.isNotBlank(bo.getRoleKey()), "r.role_key", bo.getRoleKey())
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
"r.create_time", params.get("beginTime"), params.get("endTime"))
|
"r.create_time", params.get("beginTime"), params.get("endTime"))
|
||||||
.orderByAsc("r.role_sort").orderByAsc("r.create_time");;
|
.orderByAsc("r.role_sort").orderByAsc("r.create_time");
|
||||||
|
;
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,20 +193,22 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||||||
if (ObjectUtil.isNotNull(role.getRoleId()) && LoginHelper.isSuperAdmin(role.getRoleId())) {
|
if (ObjectUtil.isNotNull(role.getRoleId()) && LoginHelper.isSuperAdmin(role.getRoleId())) {
|
||||||
throw new ServiceException("不允许操作超级管理员角色");
|
throw new ServiceException("不允许操作超级管理员角色");
|
||||||
}
|
}
|
||||||
|
String[] keys = new String[]{TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.TENANT_ADMIN_ROLE_KEY};
|
||||||
// 新增不允许使用 管理员标识符
|
// 新增不允许使用 管理员标识符
|
||||||
if (ObjectUtil.isNull(role.getRoleId())
|
if (ObjectUtil.isNull(role.getRoleId())
|
||||||
&& StringUtils.equalsAny(role.getRoleKey(),
|
&& StringUtils.equalsAny(role.getRoleKey(), keys)) {
|
||||||
TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.TENANT_ADMIN_ROLE_KEY)) {
|
|
||||||
throw new ServiceException("不允许使用系统内置管理员角色标识符!");
|
throw new ServiceException("不允许使用系统内置管理员角色标识符!");
|
||||||
}
|
}
|
||||||
// 修改不允许修改 管理员标识符
|
// 修改不允许修改 管理员标识符
|
||||||
if (ObjectUtil.isNotNull(role.getRoleId())) {
|
if (ObjectUtil.isNotNull(role.getRoleId())) {
|
||||||
SysRole sysRole = baseMapper.selectById(role.getRoleId());
|
SysRole sysRole = baseMapper.selectById(role.getRoleId());
|
||||||
// 如果标识符不相等 判断为修改了管理员标识符
|
// 如果标识符不相等 判断为修改了管理员标识符
|
||||||
if (!StringUtils.equals(sysRole.getRoleKey(), role.getRoleKey())
|
if (!StringUtils.equals(sysRole.getRoleKey(), role.getRoleKey())) {
|
||||||
&& StringUtils.equalsAny(sysRole.getRoleKey(),
|
if (StringUtils.equalsAny(sysRole.getRoleKey(), keys)) {
|
||||||
TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.TENANT_ADMIN_ROLE_KEY)) {
|
throw new ServiceException("不允许修改系统内置管理员角色标识符!");
|
||||||
throw new ServiceException("不允许修改系统内置管理员角色标识符!");
|
} else if (StringUtils.equalsAny(role.getRoleKey(), keys)) {
|
||||||
|
throw new ServiceException("不允许使用系统内置管理员角色标识符!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user