fix(系统设置): 全局用户组在项目组织层级不支持修改删除
--bug=1034867 --user=宋昌昌 【项目管理】-全局用户组在项目中展示了重命名、删除、权限编辑功能,但是没有权限操作,也没有区分哪些是全局用户组 https://www.tapd.cn/55049933/s/1457500
This commit is contained in:
parent
6d80e68e1a
commit
2abb928ec3
|
@ -7,14 +7,14 @@ import io.metersphere.project.request.ProjectUserRoleMemberRequest;
|
||||||
import io.metersphere.project.request.ProjectUserRoleRequest;
|
import io.metersphere.project.request.ProjectUserRoleRequest;
|
||||||
import io.metersphere.sdk.constants.InternalUserRole;
|
import io.metersphere.sdk.constants.InternalUserRole;
|
||||||
import io.metersphere.sdk.constants.UserRoleType;
|
import io.metersphere.sdk.constants.UserRoleType;
|
||||||
import io.metersphere.system.dto.permission.PermissionDefinitionItem;
|
|
||||||
import io.metersphere.system.dto.sdk.request.PermissionSettingUpdateRequest;
|
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.domain.UserRole;
|
import io.metersphere.system.domain.UserRole;
|
||||||
import io.metersphere.system.domain.UserRoleRelation;
|
import io.metersphere.system.domain.UserRoleRelation;
|
||||||
import io.metersphere.system.domain.UserRoleRelationExample;
|
import io.metersphere.system.domain.UserRoleRelationExample;
|
||||||
|
import io.metersphere.system.dto.permission.PermissionDefinitionItem;
|
||||||
|
import io.metersphere.system.dto.sdk.request.PermissionSettingUpdateRequest;
|
||||||
import io.metersphere.system.mapper.UserMapper;
|
import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleMapper;
|
import io.metersphere.system.mapper.UserRoleMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
||||||
|
@ -97,6 +97,7 @@ public class ProjectUserRoleService extends BaseUserRoleService {
|
||||||
UserRole userRole = get(roleId);
|
UserRole userRole = get(roleId);
|
||||||
// 非项目用户组不允许删除, 内置用户组不允许删除
|
// 非项目用户组不允许删除, 内置用户组不允许删除
|
||||||
checkProjectUserRole(userRole);
|
checkProjectUserRole(userRole);
|
||||||
|
checkGlobalUserRole(userRole);
|
||||||
super.delete(userRole, InternalUserRole.PROJECT_MEMBER.getValue(), currentUserId, userRole.getScopeId());
|
super.delete(userRole, InternalUserRole.PROJECT_MEMBER.getValue(), currentUserId, userRole.getScopeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.metersphere.system.controller.handler.result.CommonResultCode.INTERNAL_USER_ROLE_PERMISSION;
|
|
||||||
import static io.metersphere.system.controller.result.SystemResultCode.NO_GLOBAL_USER_ROLE_PERMISSION;
|
import static io.metersphere.system.controller.result.SystemResultCode.NO_GLOBAL_USER_ROLE_PERMISSION;
|
||||||
import static io.metersphere.system.controller.result.SystemResultCode.NO_PROJECT_USER_ROLE_PERMISSION;
|
import static io.metersphere.system.controller.result.SystemResultCode.NO_PROJECT_USER_ROLE_PERMISSION;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||||
|
@ -210,7 +209,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
|
||||||
// 非项目下用户组异常
|
// 非项目下用户组异常
|
||||||
this.requestGet(PROJECT_USER_ROLE_DELETE + "/" + InternalUserRole.ADMIN.getValue()).andExpect(jsonPath("$.code").value(NO_PROJECT_USER_ROLE_PERMISSION.getCode()));
|
this.requestGet(PROJECT_USER_ROLE_DELETE + "/" + InternalUserRole.ADMIN.getValue()).andExpect(jsonPath("$.code").value(NO_PROJECT_USER_ROLE_PERMISSION.getCode()));
|
||||||
// 非内置用户组异常
|
// 非内置用户组异常
|
||||||
this.requestGet(PROJECT_USER_ROLE_DELETE + "/" + InternalUserRole.PROJECT_ADMIN.getValue()).andExpect(jsonPath("$.code").value(INTERNAL_USER_ROLE_PERMISSION.getCode()));
|
this.requestGet(PROJECT_USER_ROLE_DELETE + "/" + InternalUserRole.PROJECT_ADMIN.getValue()).andExpect(jsonPath("$.code").value(NO_GLOBAL_USER_ROLE_PERMISSION.getCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -3,14 +3,14 @@ package io.metersphere.system.service;
|
||||||
import io.metersphere.sdk.constants.InternalUserRole;
|
import io.metersphere.sdk.constants.InternalUserRole;
|
||||||
import io.metersphere.sdk.constants.UserRoleEnum;
|
import io.metersphere.sdk.constants.UserRoleEnum;
|
||||||
import io.metersphere.sdk.constants.UserRoleType;
|
import io.metersphere.sdk.constants.UserRoleType;
|
||||||
import io.metersphere.system.dto.permission.PermissionDefinitionItem;
|
|
||||||
import io.metersphere.system.dto.sdk.request.PermissionSettingUpdateRequest;
|
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.*;
|
import io.metersphere.system.domain.*;
|
||||||
import io.metersphere.system.mapper.*;
|
import io.metersphere.system.dto.permission.PermissionDefinitionItem;
|
||||||
import io.metersphere.system.dto.request.OrganizationUserRoleMemberEditRequest;
|
import io.metersphere.system.dto.request.OrganizationUserRoleMemberEditRequest;
|
||||||
import io.metersphere.system.dto.request.OrganizationUserRoleMemberRequest;
|
import io.metersphere.system.dto.request.OrganizationUserRoleMemberRequest;
|
||||||
|
import io.metersphere.system.dto.sdk.request.PermissionSettingUpdateRequest;
|
||||||
|
import io.metersphere.system.mapper.*;
|
||||||
import io.metersphere.system.uid.IDGenerator;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -70,8 +70,9 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
|
|
||||||
public void delete(String roleId, String currentUserId) {
|
public void delete(String roleId, String currentUserId) {
|
||||||
UserRole userRole = get(roleId);
|
UserRole userRole = get(roleId);
|
||||||
// 非组织用户组不允许删除, 内置用户组不允许删除
|
// 非组织用户组不允许删除, 内置全局用户组不允许删除
|
||||||
checkOrgUserRole(userRole);
|
checkOrgUserRole(userRole);
|
||||||
|
checkGlobalUserRole(userRole);
|
||||||
super.delete(userRole, InternalUserRole.ORG_MEMBER.getValue(), currentUserId, userRole.getScopeId());
|
super.delete(userRole, InternalUserRole.ORG_MEMBER.getValue(), currentUserId, userRole.getScopeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.metersphere.system.controller.handler.result.CommonResultCode.INTERNAL_USER_ROLE_PERMISSION;
|
|
||||||
import static io.metersphere.system.controller.result.SystemResultCode.NO_GLOBAL_USER_ROLE_PERMISSION;
|
import static io.metersphere.system.controller.result.SystemResultCode.NO_GLOBAL_USER_ROLE_PERMISSION;
|
||||||
import static io.metersphere.system.controller.result.SystemResultCode.NO_ORG_USER_ROLE_PERMISSION;
|
import static io.metersphere.system.controller.result.SystemResultCode.NO_ORG_USER_ROLE_PERMISSION;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||||
|
@ -172,7 +171,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
// 非组织下用户组异常
|
// 非组织下用户组异常
|
||||||
this.requestGet(ORGANIZATION_USER_ROLE_DELETE + "/" + InternalUserRole.ADMIN.getValue()).andExpect(jsonPath("$.code").value(NO_ORG_USER_ROLE_PERMISSION.getCode()));
|
this.requestGet(ORGANIZATION_USER_ROLE_DELETE + "/" + InternalUserRole.ADMIN.getValue()).andExpect(jsonPath("$.code").value(NO_ORG_USER_ROLE_PERMISSION.getCode()));
|
||||||
// 非内置用户组异常
|
// 非内置用户组异常
|
||||||
this.requestGet(ORGANIZATION_USER_ROLE_DELETE + "/" + InternalUserRole.ORG_ADMIN.getValue()).andExpect(jsonPath("$.code").value(INTERNAL_USER_ROLE_PERMISSION.getCode()));
|
this.requestGet(ORGANIZATION_USER_ROLE_DELETE + "/" + InternalUserRole.ORG_ADMIN.getValue()).andExpect(jsonPath("$.code").value(NO_GLOBAL_USER_ROLE_PERMISSION.getCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue