feat(接口测试): 邮箱邀请的日志根据操作来源进行分隔
This commit is contained in:
parent
2cb323a7ba
commit
a283dec6a2
|
@ -122,7 +122,7 @@ ding_app_key_is_null=钉钉的AppKey不能为空
|
|||
ding_app_secret_is_null=钉钉的AppSecret不能为空
|
||||
# permission
|
||||
permission.project_user.name=用户
|
||||
permission.project_user.invite=邀请
|
||||
permission.project_user.invite=邀请用户
|
||||
permission.project_group.name=用户组
|
||||
permission.project_environment.name=环境管理
|
||||
permission.project_file.name=文件管理
|
||||
|
|
|
@ -137,7 +137,7 @@ module.name.is.empty=Module parameter is empty
|
|||
module.name.is.error=Module parameter is error
|
||||
# permission
|
||||
permission.project_user.name=User
|
||||
permission.project_user.invite=Invite
|
||||
permission.project_user.invite=Invite User
|
||||
permission.project_group.name=User group
|
||||
permission.project_environment.name=Environment management
|
||||
permission.project_file.name=File management
|
||||
|
|
|
@ -137,7 +137,7 @@ ding_app_key_is_null=钉钉的AppKey不能为空
|
|||
ding_app_secret_is_null=钉钉的AppSecret不能为空
|
||||
# permission
|
||||
permission.project_user.name=用户
|
||||
permission.project_user.invite=邀请
|
||||
permission.project_user.invite=邀请用户
|
||||
permission.project_group.name=用户组
|
||||
permission.project_environment.name=环境管理
|
||||
permission.project_file.name=文件管理
|
||||
|
|
|
@ -137,7 +137,7 @@ ding_app_key_is_null = 釘釘的AppKey不能為空
|
|||
ding_app_secret_is_null =釘釘的AppSecret不能為空
|
||||
# permission
|
||||
permission.project_user.name=用戶
|
||||
permission.project_user.invite=邀請
|
||||
permission.project_user.invite=邀請用户
|
||||
permission.project_group.name=用戶組
|
||||
permission.project_environment.name=環境管理
|
||||
permission.project_file.name=文件管理
|
||||
|
|
|
@ -20,6 +20,7 @@ public class BaseScheduleConfigRequest {
|
|||
|
||||
@Schema(description = "Cron表达式")
|
||||
@NotBlank
|
||||
@Size(max = 255, message = "{length.too.large}")
|
||||
private String cron;
|
||||
|
||||
@Schema(description = "运行配置")
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcelFactory;
|
|||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.project.mapper.ProjectMapper;
|
||||
import io.metersphere.sdk.constants.EmailInviteSource;
|
||||
import io.metersphere.sdk.constants.OperationLogConstants;
|
||||
import io.metersphere.sdk.constants.ParamConstants;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.*;
|
||||
|
@ -435,12 +436,18 @@ public class SimpleUserService {
|
|||
if (MapUtils.isNotEmpty(errorMap)) {
|
||||
throw new MSException(SystemResultCode.INVITE_EMAIL_EXIST, JSON.toJSONString(errorMap.keySet()));
|
||||
}
|
||||
String logProjectId = "", logOrgId = "";
|
||||
if (StringUtils.equals(inviteSource, EmailInviteSource.SYSTEM.name())) {
|
||||
logProjectId = OperationLogConstants.SYSTEM;
|
||||
logOrgId = OperationLogConstants.SYSTEM;
|
||||
//校验角色的合法性
|
||||
globalUserRoleService.checkRoleIsGlobalAndHaveMember(request.getUserRoleIds(), true);
|
||||
request.setOrganizationId(EmailInviteSource.SYSTEM.name());
|
||||
request.setProjectId(EmailInviteSource.SYSTEM.name());
|
||||
} else if (StringUtils.equals(inviteSource, EmailInviteSource.ORGANIZATION.name())) {
|
||||
logProjectId = OperationLogConstants.ORGANIZATION;
|
||||
logOrgId = request.getOrganizationId();
|
||||
|
||||
OrganizationService organizationService = CommonBeanFactory.getBean(OrganizationService.class);
|
||||
organizationService.checkOrgExistById(request.getOrganizationId());
|
||||
organizationService.checkUseRoleExist(request.getUserRoleIds(), request.getOrganizationId());
|
||||
|
@ -452,12 +459,15 @@ public class SimpleUserService {
|
|||
throw new MSException(Translator.get("project_not_exist"));
|
||||
}
|
||||
request.setOrganizationId(project.getOrganizationId());
|
||||
|
||||
logProjectId = project.getId();
|
||||
logOrgId = project.getOrganizationId();
|
||||
}
|
||||
|
||||
List<UserInvite> inviteList = userInviteService.batchInsert(
|
||||
request.getInviteEmails(), inviteUser.getId(), request.getUserRoleIds(), request.getOrganizationId(), request.getProjectId());
|
||||
//记录日志
|
||||
userLogService.addEmailInviteLog(inviteList, inviteUser.getId());
|
||||
userLogService.addEmailInviteLog(inviteList, logProjectId, logOrgId, inviteUser.getId());
|
||||
this.sendInviteEmail(inviteList, inviteUser.getName());
|
||||
return new UserInviteResponse(inviteList);
|
||||
}
|
||||
|
|
|
@ -294,15 +294,24 @@ public class UserLogService {
|
|||
operationLogService.batchAdd(logs);
|
||||
}
|
||||
|
||||
public void addEmailInviteLog(List<UserInvite> userInviteList, String inviteUserId) {
|
||||
public void addEmailInviteLog(List<UserInvite> userInviteList, String projectId, String orgId, String inviteUserId) {
|
||||
String module = null;
|
||||
if (StringUtils.equals(projectId, OperationLogConstants.SYSTEM)) {
|
||||
module = OperationLogModule.SETTING_SYSTEM_USER_SINGLE;
|
||||
} else if (StringUtils.equals(projectId, OperationLogConstants.ORGANIZATION)) {
|
||||
module = OperationLogModule.SETTING_ORGANIZATION_USER_ROLE;
|
||||
} else {
|
||||
module = OperationLogModule.PROJECT_MANAGEMENT_PERMISSION_USER_ROLE;
|
||||
}
|
||||
User inviteUser = userMapper.selectByPrimaryKey(inviteUserId);
|
||||
List<LogDTO> saveLogs = new ArrayList<>();
|
||||
String finalModule = module;
|
||||
userInviteList.forEach(userInvite -> {
|
||||
LogDTO log = LogDTOBuilder.builder()
|
||||
.projectId(OperationLogConstants.SYSTEM)
|
||||
.module(OperationLogModule.SETTING_SYSTEM_USER_SINGLE)
|
||||
.projectId(projectId)
|
||||
.module(finalModule)
|
||||
.createUser(inviteUserId)
|
||||
.organizationId(OperationLogConstants.SYSTEM)
|
||||
.organizationId(orgId)
|
||||
.sourceId(inviteUserId)
|
||||
.type(OperationLogType.ADD.name())
|
||||
.content(inviteUser.getName() + Translator.get("user.invite.email") + ":" + userInvite.getEmail())
|
||||
|
|
Loading…
Reference in New Issue