refactor(项目设置): 项目成员列表优化&初始化项目版本管理页面权限

This commit is contained in:
song-cc-rock 2023-09-18 15:34:18 +08:00 committed by 刘瑞斌
parent 1be40236ff
commit e8a4b1d3f5
8 changed files with 43 additions and 8 deletions

View File

@ -95,6 +95,10 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_MESSAGE:READ+ADD'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_MESSAGE:READ+ADD');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_MESSAGE:READ+UPDATE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_MESSAGE:READ+UPDATE');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_MESSAGE:READ+DELETE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_MESSAGE:READ+DELETE');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_VERSION:READ');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_VERSION:READ+ADD');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_VERSION:READ+UPDATE');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_VERSION:READ+DELETE');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_FAKE_ERROR:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_FAKE_ERROR:READ');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_FAKE_ERROR:READ+ADD'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_FAKE_ERROR:READ+ADD');
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_FAKE_ERROR:READ+UPDATE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_FAKE_ERROR:READ+UPDATE');

View File

@ -168,5 +168,13 @@ public class PermissionConstants {
public static final String PROJECT_ENVIRONMENT_READ_EXPORT = "PROJECT_ENVIRONMENT:READ+EXPORT"; public static final String PROJECT_ENVIRONMENT_READ_EXPORT = "PROJECT_ENVIRONMENT:READ+EXPORT";
/*------ end: PROJECT_ENVIRONMENT ------*/ /*------ end: PROJECT_ENVIRONMENT ------*/
/**
* 项目版本权限
*/
/*------ start: PROJECT_VERSION ------*/
public static final String PROJECT_VERSION_READ = "PROJECT_VERSION:READ";
public static final String PROJECT_VERSION_READ_ADD = "PROJECT_VERSION:READ+ADD";
public static final String PROJECT_VERSION_READ_UPDATE = "PROJECT_VERSION:READ+UPDATE";
public static final String PROJECT_VERSION_READ_DELETE = "PROJECT_VERSION:READ+DELETE";
/*------ end: PROJECT_VERSION ------*/
} }

View File

@ -129,7 +129,9 @@ permission.project_application_api.read=API test read
permission.project_application_api.update=API test update permission.project_application_api.update=API test update
permission.project_base_info.name=Project base info permission.project_base_info.name=Project base info
permission.project_log.name=Operation log permission.project_log.name=Operation log
# project version
project.version.exist=Version exist
project.version.not_exist=Version not exist
#environment datasource #environment datasource
environment_datasource.id.not_blank=ID is required environment_datasource.id.not_blank=ID is required
environment_datasource.driver.not_blank=Driver is required environment_datasource.driver.not_blank=Driver is required

View File

@ -129,7 +129,9 @@ permission.project_application_api.read=接口测试-查询
permission.project_application_api.update=接口测试-编辑 permission.project_application_api.update=接口测试-编辑
permission.project_base_info.name=基本信息 permission.project_base_info.name=基本信息
permission.project_log.name=日志 permission.project_log.name=日志
# project version
project.version.exist=版本已存在
project.version.not_exist=版本不存在
#environment datasource #environment datasource
environment_datasource.id.not_blank=ID不能为空 environment_datasource.id.not_blank=ID不能为空
environment_datasource.driver.not_blank=驱动不能为空 environment_datasource.driver.not_blank=驱动不能为空

View File

@ -129,7 +129,9 @@ permission.project_application_api.read=接口測試-查詢
permission.project_application_api.update=接口測試-編輯 permission.project_application_api.update=接口測試-編輯
permission.project_base_info.name=基本信息 permission.project_base_info.name=基本信息
permission.project_log.name=日誌 permission.project_log.name=日誌
# project version
project.version.exist=版本已存在
project.version.not_exist=版本不存在
#environment datasource #environment datasource
environment_datasource.id.not_blank=ID不能為空 environment_datasource.id.not_blank=ID不能為空
environment_datasource.driver.not_blank=驅動不能為空 environment_datasource.driver.not_blank=驅動不能為空

View File

@ -14,6 +14,7 @@
</if> </if>
<include refid="filter"/> <include refid="filter"/>
</where> </where>
order by u.name
</select> </select>
<select id="getMemberByOrg" resultType="io.metersphere.sdk.dto.UserExtend"> <select id="getMemberByOrg" resultType="io.metersphere.sdk.dto.UserExtend">

View File

@ -31,10 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -102,6 +99,7 @@ public class ProjectMemberService {
User user = userMap.get(projectUser.getId()); User user = userMap.get(projectUser.getId());
BeanUtils.copyBean(projectUser, user); BeanUtils.copyBean(projectUser, user);
}); });
projectUsers.sort(Comparator.comparing(ProjectUserDTO::getName));
return projectUsers; return projectUsers;
} }

View File

@ -103,6 +103,24 @@
} }
] ]
}, },
{
"id": "PROJECT_VERSION",
"name": "permission.project_version.name",
"permissions": [
{
"id": "PROJECT_VERSION:READ"
},
{
"id": "PROJECT_VERSION:READ+ADD"
},
{
"id": "PROJECT_VERSION:READ+UPDATE"
},
{
"id": "PROJECT_VERSION:READ+DELETE"
}
]
},
{ {
"id": "PROJECT_FAKE_ERROR", "id": "PROJECT_FAKE_ERROR",
"name": "permission.project_fake_error.name", "name": "permission.project_fake_error.name",