fix(项目管理): 删除成员日志缺少操作人

This commit is contained in:
song-cc-rock 2023-09-04 10:59:28 +08:00 committed by 刘瑞斌
parent c6e6132651
commit 1e5a94c05f
3 changed files with 16 additions and 6 deletions

View File

@ -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";

View File

@ -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());
}
}

View File

@ -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<LogDTO> 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<LogDTO> 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);
}