diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java index fb4df7f815..31813eddbe 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java @@ -97,6 +97,16 @@ public class PermissionConstants { public static final String PROJECT_MEMBER_DELETE = "PROJECT_MEMBER:READ+DELETE"; /*------ end: PROJECT_MEMBER ------*/ + /** + * 项目用户组 + */ + /*------ start: PROJECT_USER_ROLE ------*/ + public static final String PROJECT_USER_ROLE_READ = "PROJECT_USER_ROLE:READ"; + public static final String PROJECT_USER_ROLE_ADD = "PROJECT_USER_ROLE:READ+ADD"; + public static final String PROJECT_USER_ROLE_UPDATE = "PROJECT_USER_ROLE:READ+UPDATE"; + public static final String PROJECT_USER_ROLE_DELETE = "PROJECT_USER_ROLE:READ+DELETE"; + /*------ end: PROJECT_USER_ROLE ------*/ + public static final String SYSTEM_AUTH_READ = "SYSTEM_AUTH:READ"; public static final String SYSTEM_AUTH_READ_UPDATE = "SYSTEM_AUTH:READ+UPDATE"; diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectMemberController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectMemberController.java index 1c19b1f13c..388d4ffd89 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectMemberController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectMemberController.java @@ -83,7 +83,7 @@ public class ProjectMemberController { }) @RequiresPermissions(PermissionConstants.PROJECT_MEMBER_DELETE) public void removeMember(@PathVariable String projectId, @PathVariable String userId) { - projectMemberService.removeMember(projectId, userId); + projectMemberService.removeMember(projectId, userId, SessionUtils.getUserId()); } @PostMapping("/add-role") @@ -97,6 +97,6 @@ public class ProjectMemberController { @Operation(summary = "项目管理-成员-批量从项目移除") @RequiresPermissions(PermissionConstants.PROJECT_MEMBER_DELETE) public void batchRemove(@RequestBody ProjectMemberBatchDeleteRequest request) { - projectMemberService.batchRemove(request); + projectMemberService.batchRemove(request, SessionUtils.getUserId()); } } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java index 23d671def4..752d4152cf 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java @@ -218,7 +218,7 @@ public class ProjectMemberService { * @param projectId 项目ID * @param userId 用户ID */ - public void removeMember(String projectId, String userId) { + public void removeMember(String projectId, String userId, String currentUserId) { // 操作记录 List logs = new ArrayList<>(); // 项目不存在, 则不移除 @@ -228,7 +228,7 @@ public class ProjectMemberService { example.createCriteria().andSourceIdEqualTo(projectId).andUserIdEqualTo(userId); userRoleRelationMapper.deleteByExample(example); // 操作记录 - setLog(projectId, userId, null, OperationLogType.DELETE.name(), "/project/member/remove", HttpMethodConstants.GET.name(), null, null, logs); + setLog(projectId, userId, currentUserId, OperationLogType.DELETE.name(), "/project/member/remove", HttpMethodConstants.GET.name(), null, null, logs); operationLogService.batchAdd(logs); } @@ -309,7 +309,7 @@ public class ProjectMemberService { * 批量移除成员(项目) * @param request 请求参数 */ - public void batchRemove(ProjectMemberBatchDeleteRequest request) { + public void batchRemove(ProjectMemberBatchDeleteRequest request, String currentUserId) { // 操作记录 List logs = new ArrayList<>(); // 项目不存在, 则不移除 @@ -322,7 +322,7 @@ public class ProjectMemberService { // 操作记录 request.getUserIds().forEach(userId -> { // 操作记录 - setLog(request.getProjectId(), userId, null, OperationLogType.DELETE.name(), "/project/member/remove", HttpMethodConstants.GET.name(), null, null, logs); + setLog(request.getProjectId(), userId, currentUserId, OperationLogType.DELETE.name(), "/project/member/remove", HttpMethodConstants.GET.name(), null, null, logs); }); operationLogService.batchAdd(logs); }