fix(系统设置): 超级用户组权限可以编辑
--bug=1020915 --user=李玉号 【系统设置】用户组与权限-超级管理员-权限可以编辑 https://www.tapd.cn/55049933/s/1316209
This commit is contained in:
parent
8439cd8b11
commit
0f4cfcc821
|
@ -70,6 +70,8 @@ public class GroupService {
|
||||||
@Resource
|
@Resource
|
||||||
private BaseUserService baseUserService;
|
private BaseUserService baseUserService;
|
||||||
private static final String GLOBAL = "global";
|
private static final String GLOBAL = "global";
|
||||||
|
private static final String SUPER_GROUP = "super_group";
|
||||||
|
|
||||||
|
|
||||||
// 服务权限拼装顺序
|
// 服务权限拼装顺序
|
||||||
private static final String[] servicePermissionLoadOrder = {MicroServiceName.PROJECT_MANAGEMENT,
|
private static final String[] servicePermissionLoadOrder = {MicroServiceName.PROJECT_MANAGEMENT,
|
||||||
|
@ -223,6 +225,9 @@ public class GroupService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editGroupPermission(EditGroupRequest request) {
|
public void editGroupPermission(EditGroupRequest request) {
|
||||||
|
if (StringUtils.equals(request.getUserGroupId(), SUPER_GROUP)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
List<GroupPermission> permissions = request.getPermissions();
|
List<GroupPermission> permissions = request.getPermissions();
|
||||||
if (CollectionUtils.isEmpty(permissions)) {
|
if (CollectionUtils.isEmpty(permissions)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -235,6 +235,10 @@ public class GroupService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editGroupPermission(EditGroupRequest request) {
|
public void editGroupPermission(EditGroupRequest request) {
|
||||||
|
// 超级用户组禁止修改权限
|
||||||
|
if (StringUtils.equals(request.getUserGroupId(), SUPER_GROUP)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
List<GroupPermission> permissions = request.getPermissions();
|
List<GroupPermission> permissions = request.getPermissions();
|
||||||
if (CollectionUtils.isEmpty(permissions)) {
|
if (CollectionUtils.isEmpty(permissions)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -99,7 +99,10 @@ export default {
|
||||||
},
|
},
|
||||||
isReadOnly() {
|
isReadOnly() {
|
||||||
return function (data) {
|
return function (data) {
|
||||||
const isDefaultSystemGroup = (this.group.id === 'admin' || this.group.id === 'super_group') && data.resource.id === 'SYSTEM_GROUP';
|
if (this.group.id === 'super_group') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const isDefaultSystemGroup = this.group.id === 'admin' && data.resource.id === 'SYSTEM_GROUP';
|
||||||
return this.readOnly || isDefaultSystemGroup;
|
return this.readOnly || isDefaultSystemGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,13 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
isReadOnly() {
|
isReadOnly() {
|
||||||
return function (permission) {
|
return function (permission) {
|
||||||
|
// 禁止取消系统管理员用户组权限
|
||||||
|
if (this.group.id === 'super_group') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// 禁止取消系统管理员用户组和超级管理员用户组的读取和设置权限
|
// 禁止取消系统管理员用户组和超级管理员用户组的读取和设置权限
|
||||||
const isSystemGroupPermission = permission.id === 'SYSTEM_GROUP:READ' || permission.id === 'SYSTEM_GROUP:READ+SETTING_PERMISSION';
|
const isSystemGroupPermission = permission.id === 'SYSTEM_GROUP:READ' || permission.id === 'SYSTEM_GROUP:READ+SETTING_PERMISSION';
|
||||||
const isDefaultSystemGroup = (this.group.id === 'admin' || this.group.id === 'super_group') && isSystemGroupPermission;
|
const isDefaultSystemGroup = this.group.id === 'admin' && isSystemGroupPermission;
|
||||||
return this.readOnly || isDefaultSystemGroup;
|
return this.readOnly || isDefaultSystemGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue