fix(系统设置): 超级用户组权限可以编辑

--bug=1020915 --user=李玉号 【系统设置】用户组与权限-超级管理员-权限可以编辑
https://www.tapd.cn/55049933/s/1316209
This commit is contained in:
shiziyuan9527 2022-12-16 10:47:38 +08:00 committed by lyh
parent b7af6738b4
commit af50472fa9
4 changed files with 18 additions and 2 deletions

View File

@ -70,6 +70,8 @@ public class GroupService {
@Resource
private BaseUserService baseUserService;
private static final String GLOBAL = "global";
private static final String SUPER_GROUP = "super_group";
// 服务权限拼装顺序
private static final String[] servicePermissionLoadOrder = {MicroServiceName.PROJECT_MANAGEMENT,
@ -223,6 +225,9 @@ public class GroupService {
}
public void editGroupPermission(EditGroupRequest request) {
if (StringUtils.equals(request.getUserGroupId(), SUPER_GROUP)) {
return;
}
List<GroupPermission> permissions = request.getPermissions();
if (CollectionUtils.isEmpty(permissions)) {
return;

View File

@ -235,6 +235,10 @@ public class GroupService {
}
public void editGroupPermission(EditGroupRequest request) {
// 超级用户组禁止修改权限
if (StringUtils.equals(request.getUserGroupId(), SUPER_GROUP)) {
return;
}
List<GroupPermission> permissions = request.getPermissions();
if (CollectionUtils.isEmpty(permissions)) {
return;

View File

@ -99,7 +99,10 @@ export default {
},
isReadOnly() {
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;
}
}

View File

@ -44,9 +44,13 @@ export default {
computed: {
isReadOnly() {
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 isDefaultSystemGroup = (this.group.id === 'admin' || this.group.id === 'super_group') && isSystemGroupPermission;
const isDefaultSystemGroup = this.group.id === 'admin' && isSystemGroupPermission;
return this.readOnly || isDefaultSystemGroup;
}
}