diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectUserRoleController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectUserRoleController.java index 4cf74416d1..d132e45910 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectUserRoleController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectUserRoleController.java @@ -2,9 +2,11 @@ package io.metersphere.project.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; +import io.metersphere.project.dto.ProjectUserRoleDTO; import io.metersphere.project.request.ProjectUserRoleEditRequest; import io.metersphere.project.request.ProjectUserRoleMemberEditRequest; import io.metersphere.project.request.ProjectUserRoleMemberRequest; +import io.metersphere.project.request.ProjectUserRoleRequest; import io.metersphere.project.service.ProjectUserRoleLogService; import io.metersphere.project.service.ProjectUserRoleService; import io.metersphere.sdk.constants.PermissionConstants; @@ -39,12 +41,12 @@ public class ProjectUserRoleController { @Resource ProjectUserRoleService projectUserRoleService; - @GetMapping("/list/{projectId}") + @PostMapping("/list") @Operation(summary = "项目管理-项目与权限-用户组-获取用户组列表") - @Parameter(name = "projectId", description = "当前项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) @RequiresPermissions(PermissionConstants.PROJECT_GROUP_READ) - public List list(@PathVariable String projectId) { - return projectUserRoleService.list(projectId); + public Pager> list(@Validated @RequestBody ProjectUserRoleRequest request) { + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize()); + return PageUtils.setPageInfo(page, projectUserRoleService.list(request)); } @PostMapping("/add") diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/ProjectUserRoleDTO.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/ProjectUserRoleDTO.java new file mode 100644 index 0000000000..72f91b1a59 --- /dev/null +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/ProjectUserRoleDTO.java @@ -0,0 +1,27 @@ +package io.metersphere.project.dto; + +import io.metersphere.system.domain.UserRole; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 项目用户组列表DTO + * + * @author song-cc-rock + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class ProjectUserRoleDTO extends UserRole { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 成员数目 + */ + @Schema(description = "成员数目") + private Integer memberCount; +} diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java index 2fd282ebe1..5305d32240 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java @@ -1,7 +1,10 @@ package io.metersphere.project.mapper; +import io.metersphere.project.dto.ProjectUserRoleDTO; import io.metersphere.project.request.ProjectUserRoleMemberRequest; +import io.metersphere.project.request.ProjectUserRoleRequest; import io.metersphere.system.domain.User; +import io.metersphere.system.domain.UserRoleRelation; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -11,8 +14,25 @@ import java.util.List; */ public interface ExtProjectUserRoleMapper { + /** + * 获取项目用户组列表 + * + * @param request 请求参数 + * @return 项目用户组列表 + */ + List list(@Param("request") ProjectUserRoleRequest request); + + /** + * 根据用户组ID获取用户组成员关系 + * + * @param roleIds 用户组ID集合 + * @return 用户组成员关系 + */ + List getRelationByRoleIds(@Param("roleIds") List roleIds); + /** * 获取项目成员列表 + * * @param request 请求参数 * @return 项目成员列表 */ @@ -20,6 +40,7 @@ public interface ExtProjectUserRoleMapper { /** * 根据项目id获取 项目成员 + * * @param sourceId * @return */ diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml index f65ac725eb..1acda34176 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml @@ -1,6 +1,28 @@ + + + + \ No newline at end of file diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectUserRoleRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectUserRoleRequest.java new file mode 100644 index 0000000000..1b465cf4f3 --- /dev/null +++ b/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectUserRoleRequest.java @@ -0,0 +1,22 @@ +package io.metersphere.project.request; + +import io.metersphere.sdk.dto.BasePageRequest; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目用户组列表请求参数 + * + * @author song-cc-rock + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class ProjectUserRoleRequest extends BasePageRequest { + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String projectId; +} diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectUserRoleService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectUserRoleService.java index 852c5b56aa..95779af3bc 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectUserRoleService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectUserRoleService.java @@ -1,10 +1,11 @@ package io.metersphere.project.service; +import io.metersphere.project.dto.ProjectUserRoleDTO; import io.metersphere.project.mapper.ExtProjectUserRoleMapper; import io.metersphere.project.request.ProjectUserRoleMemberEditRequest; import io.metersphere.project.request.ProjectUserRoleMemberRequest; +import io.metersphere.project.request.ProjectUserRoleRequest; import io.metersphere.sdk.constants.InternalUserRole; -import io.metersphere.sdk.constants.UserRoleEnum; import io.metersphere.sdk.constants.UserRoleType; import io.metersphere.sdk.dto.PermissionDefinitionItem; import io.metersphere.sdk.dto.UserExtend; @@ -25,7 +26,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -50,12 +50,28 @@ public class ProjectUserRoleService extends BaseUserRoleService { @Resource ExtProjectUserRoleMapper extProjectUserRoleMapper; - public List list(String projectId) { - UserRoleExample example = new UserRoleExample(); - example.createCriteria().andTypeEqualTo(UserRoleType.PROJECT.name()) - .andScopeIdIn(Arrays.asList(projectId, UserRoleEnum.GLOBAL.toString())); - example.setOrderByClause("create_time asc"); - return userRoleMapper.selectByExample(example); + public List list(ProjectUserRoleRequest request) { + List roles = extProjectUserRoleMapper.list(request); + if (CollectionUtils.isEmpty(roles)) { + return new ArrayList<>(); + } + List roleIds = roles.stream().map(ProjectUserRoleDTO::getId).toList(); + List relations = extProjectUserRoleMapper.getRelationByRoleIds(roleIds); + if (CollectionUtils.isNotEmpty(relations)) { + Map countMap = relations.stream().collect(Collectors.groupingBy(UserRoleRelation::getRoleId, Collectors.counting())); + roles.forEach(role -> { + if (countMap.containsKey(role.getId())) { + role.setMemberCount(countMap.get(role.getId()).intValue()); + } else { + role.setMemberCount(0); + } + }); + } else { + roles.forEach(role -> { + role.setMemberCount(0); + }); + } + return roles; } @Override diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java index aacdbd759d..489e958f0e 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java @@ -1,8 +1,10 @@ package io.metersphere.project.controller; +import io.metersphere.project.dto.ProjectUserRoleDTO; import io.metersphere.project.request.ProjectUserRoleEditRequest; import io.metersphere.project.request.ProjectUserRoleMemberEditRequest; import io.metersphere.project.request.ProjectUserRoleMemberRequest; +import io.metersphere.project.request.ProjectUserRoleRequest; import io.metersphere.sdk.base.BaseTest; import io.metersphere.sdk.constants.InternalUserRole; import io.metersphere.sdk.constants.PermissionConstants; @@ -13,7 +15,6 @@ import io.metersphere.sdk.service.BaseUserRolePermissionService; import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.Pager; import io.metersphere.system.domain.User; -import io.metersphere.system.domain.UserRole; import io.metersphere.system.request.OrganizationUserRoleEditRequest; import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; @@ -28,6 +29,7 @@ import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.ResultMatcher; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import java.io.Serial; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -63,17 +65,42 @@ public class ProjectUserRoleControllerTests extends BaseTest { @Order(0) @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "/dml/init_project_user_role.sql") public void testProjectUserRoleListSuccess() throws Exception { - String projectId = "default-project-2"; - MvcResult mvcResult = this.responseGet(PROJECT_USER_ROLE_LIST + "/" + projectId); + ProjectUserRoleRequest request = new ProjectUserRoleRequest(); + request.setCurrent(1); + request.setPageSize(10); + request.setProjectId("default-project-2"); + request.setKeyword("default-pro-role-3"); + MvcResult mvcResult = this.responsePost(PROJECT_USER_ROLE_LIST, request); // 获取返回值 String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); // 返回请求正常 Assertions.assertNotNull(resultHolder); - // 返回总条数是否为init_project_user_role.sql中的数据总数 - Assertions.assertFalse(JSON.parseArray(JSON.toJSONString(resultHolder.getData())).isEmpty()); + Pager pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class); + // 返回值不为空 + Assertions.assertNotNull(pageData); + // 返回值的页码和当前页码相同 + Assertions.assertEquals(pageData.getCurrent(), request.getCurrent()); + // 返回的数据量不超过规定要返回的数据量相同 + Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize()); + // 返回值中取出第一条数据, 并判断是否包含关键字default + ProjectUserRoleDTO projectUserRoleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0); + Assertions.assertTrue(StringUtils.contains(projectUserRoleDTO.getName(), request.getKeyword()) + || StringUtils.contains(projectUserRoleDTO.getId(), request.getKeyword())); // 权限校验 - requestGetPermissionTest(PermissionConstants.PROJECT_GROUP_READ, PROJECT_USER_ROLE_LIST + "/" + DEFAULT_PROJECT_ID); + request.setProjectId(DEFAULT_PROJECT_ID); + requestPostPermissionTest(PermissionConstants.PROJECT_GROUP_READ, PROJECT_USER_ROLE_LIST, request); + + // 覆盖用户组没有成员的情况 + request.setProjectId("default-project-2"); + request.setKeyword(""); + this.requestPost(PROJECT_USER_ROLE_LIST, request); + // 覆盖空数据 + request.setProjectId("default-project-3"); + request.setKeyword("project_member"); + this.requestPost(PROJECT_USER_ROLE_LIST, request); + request.setKeyword("not_exit"); + this.requestPost(PROJECT_USER_ROLE_LIST, request); } @Test @@ -84,15 +111,23 @@ public class ProjectUserRoleControllerTests extends BaseTest { request.setScopeId("default-project-2"); this.requestPost(PROJECT_USER_ROLE_ADD, request); // 验证是否添加成功 - String projectId = "default-project-2"; - MvcResult mvcResult = this.responseGet(PROJECT_USER_ROLE_LIST + "/" + projectId); + ProjectUserRoleRequest roleRequest = new ProjectUserRoleRequest(); + roleRequest.setCurrent(1); + roleRequest.setPageSize(10); + roleRequest.setProjectId("default-project-2"); + roleRequest.setKeyword("default-pro-role-5"); + MvcResult mvcResult = this.responsePost(PROJECT_USER_ROLE_LIST, roleRequest); // 获取返回值 String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); // 返回请求正常 Assertions.assertNotNull(resultHolder); - // 返回总条数是否为init_project_user_role.sql中的数据总数 - Assertions.assertFalse(JSON.parseArray(JSON.toJSONString(resultHolder.getData())).isEmpty()); + Pager pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class); + // 返回值不为空, 取第一条是否包含关键字 + Assertions.assertNotNull(pageData); + ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0); + Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword()) + || StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword())); // 权限校验 requestPostPermissionTest(PermissionConstants.PROJECT_GROUP_ADD, PROJECT_USER_ROLE_ADD, request); } @@ -139,16 +174,23 @@ public class ProjectUserRoleControllerTests extends BaseTest { request.setScopeId("default-project-2"); this.requestPost(PROJECT_USER_ROLE_UPDATE, request, status().isOk()); // 验证是否修改成功 - String projectId = "default-project-2"; - MvcResult mvcResult = this.responseGet(PROJECT_USER_ROLE_LIST + "/" + projectId); + ProjectUserRoleRequest roleRequest = new ProjectUserRoleRequest(); + roleRequest.setCurrent(1); + roleRequest.setPageSize(10); + roleRequest.setProjectId("default-project-2"); + roleRequest.setKeyword("default-pro-role-x"); + MvcResult mvcResult = this.responsePost(PROJECT_USER_ROLE_LIST, roleRequest); // 获取返回值 String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); // 返回请求正常 Assertions.assertNotNull(resultHolder); - // 返回总条数是否包含修改后的数据 - List userRoles = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), UserRole.class); - Assertions.assertTrue(userRoles.stream().anyMatch(userRole -> "default-pro-role-x".equals(userRole.getName()))); + Pager pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class); + // 返回值不为空 + Assertions.assertNotNull(pageData); + ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0); + Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword()) + || StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword())); // 权限校验 requestPostPermissionTest(PermissionConstants.PROJECT_GROUP_UPDATE, PROJECT_USER_ROLE_UPDATE, request); } @@ -256,7 +298,7 @@ public class ProjectUserRoleControllerTests extends BaseTest { Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize()); // 返回值中取出第一条数据, 并判断是否包含关键字 List userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class); - if(CollectionUtils.isNotEmpty(userList)) { + if (CollectionUtils.isNotEmpty(userList)) { User user = userList.get(0); Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword()) || StringUtils.contains(user.getId(), request.getKeyword())); @@ -376,9 +418,12 @@ public class ProjectUserRoleControllerTests extends BaseTest { this.requestGet(PROJECT_USER_ROLE_DELETE + "/default-pro-role-id-3", status().isOk()); } - private PermissionSettingUpdateRequest getPermissionSettingUpdateRequest(){ + private PermissionSettingUpdateRequest getPermissionSettingUpdateRequest() { PermissionSettingUpdateRequest request = new PermissionSettingUpdateRequest(); request.setPermissions(new ArrayList<>() { + @Serial + private static final long serialVersionUID = -1719021806631967745L; + { // 取消PROJECT_GROUP:READ权限 add(new PermissionSettingUpdateRequest.PermissionUpdateRequest("PROJECT_GROUP:READ", false)); diff --git a/backend/services/project-management/src/test/resources/dml/init_project_user_role.sql b/backend/services/project-management/src/test/resources/dml/init_project_user_role.sql index ff4bf88b9b..1f9d1e5209 100644 --- a/backend/services/project-management/src/test/resources/dml/init_project_user_role.sql +++ b/backend/services/project-management/src/test/resources/dml/init_project_user_role.sql @@ -1,19 +1,36 @@ # 项目用户组数据准备 -INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUE - ('default-project-1', null, 'default-organization-1', '默认项目-1', '系统默认创建的项目-1', 'admin', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000); -INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUE - ('default-project-2', null, 'default-organization-2', '默认项目-2', '系统默认创建的项目-2', 'admin', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000); -INSERT INTO user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source, last_project_id, create_user, update_user) VALUE - ('default-pro-admin-user', 'default-pro-admin-1', 'admin-default-pro-user@metersphere.io', MD5('metersphere'), UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin'); -INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUES - ('default-pro-role-id-1', 'default-pro-role-1', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'), - ('default-pro-role-id-2', 'default-pro-role-2', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'), - ('default-pro-role-id-3', 'default-pro-role-3', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'), - ('default-pro-role-id-4', 'default-pro-role-4', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'); -INSERT INTO user_role_permission (id, role_id, permission_id) VALUE - (uuid(), 'default-org-role-id-3', 'PROJECT_USER_GROUP:READ'); -INSERT INTO user_role_relation (id, user_id, role_id, source_id, organization_id, create_time, create_user) VALUES - (UUID(), 'default-pro-admin-user', 'default-pro-role-id-3', 'default-project-2', 'default-project-2', UNIX_TIMESTAMP() * 1000, 'admin'), - (UUID(), 'default-pro-admin-user', 'default-pro-role-id-4', 'default-project-2', 'default-project-2', UNIX_TIMESTAMP() * 1000, 'admin'), - (UUID(), 'default-admin-user-x', 'default-pro-role-id-4', 'default-project-2', 'default-project-2', UNIX_TIMESTAMP() * 1000, 'admin'), - (UUID(), 'default-admin-user-x', 'default-pro-role-id-3', 'default-organization-4', 'default-project-4', UNIX_TIMESTAMP() * 1000, 'admin'); \ No newline at end of file +INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, + update_time) VALUE + ('default-project-1', null, 'default-organization-1', '默认项目-1', '系统默认创建的项目-1', 'admin', 'admin', + UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000); +INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, + update_time) VALUE + ('default-project-2', null, 'default-organization-2', '默认项目-2', '系统默认创建的项目-2', 'admin', 'admin', + UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000); +INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, + update_time) VALUE + ('default-project-3', null, 'default-organization-2', '默认项目-2', '系统默认创建的项目-2', 'admin', 'admin', + UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000); +INSERT INTO user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source, + last_project_id, create_user, update_user) VALUE + ('default-pro-admin-user', 'default-pro-admin-1', 'admin-default-pro-user@metersphere.io', MD5('metersphere'), + UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin'); +INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) +VALUES ('default-pro-role-id-1', 'default-pro-role-1', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, + UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'), + ('default-pro-role-id-2', 'default-pro-role-2', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, + UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'), + ('default-pro-role-id-3', 'default-pro-role-3', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, + UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'), + ('default-pro-role-id-4', 'default-pro-role-4', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, + UNIX_TIMESTAMP() * 1000, 'admin', 'default-project-2'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUE (uuid(), 'default-org-role-id-3', 'PROJECT_USER_GROUP:READ'); +INSERT INTO user_role_relation (id, user_id, role_id, source_id, organization_id, create_time, create_user) +VALUES (UUID(), 'default-pro-admin-user', 'default-pro-role-id-3', 'default-project-2', 'default-project-2', + UNIX_TIMESTAMP() * 1000, 'admin'), + (UUID(), 'default-pro-admin-user', 'default-pro-role-id-4', 'default-project-2', 'default-project-2', + UNIX_TIMESTAMP() * 1000, 'admin'), + (UUID(), 'default-admin-user-x', 'default-pro-role-id-4', 'default-project-2', 'default-project-2', + UNIX_TIMESTAMP() * 1000, 'admin'), + (UUID(), 'default-admin-user-x', 'default-pro-role-id-3', 'default-organization-4', 'default-project-4', + UNIX_TIMESTAMP() * 1000, 'admin'); \ No newline at end of file