fix(系统设置): 修复项目添加成员报错的缺陷

This commit is contained in:
wxg0103 2024-02-01 20:23:57 +08:00 committed by 刘瑞斌
parent 123fd03839
commit cf40902d99
3 changed files with 5 additions and 9 deletions

View File

@ -128,7 +128,7 @@ public class OrganizationProjectController {
@PostMapping("/add-members")
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_MEMBER_ADD)
@Operation(summary = "系统设置-组织-项目-添加成员")
@CheckOwner(resourceId = "#request.id", resourceType = "project")
@CheckOwner(resourceId = "#request.projectId", resourceType = "project")
public void addProjectMember(@Validated @RequestBody ProjectAddMemberRequest request) {
ProjectAddMemberBatchRequest batchRequest = new ProjectAddMemberBatchRequest();
batchRequest.setProjectIds(List.of(request.getProjectId()));

View File

@ -3,16 +3,14 @@ package io.metersphere.system.dto.request;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.util.List;
@Data
public class ProjectAddMemberBatchRequest extends ProjectAddMemberRequest{
@Schema(description = "项目ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
public class ProjectAddMemberBatchRequest extends ProjectAddMemberRequest {
@Schema(description = "项目ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
private List<
@NotBlank(message = "{project.id.not_blank}", groups = {Created.class, Updated.class})
String> projectIds;

View File

@ -3,7 +3,6 @@ package io.metersphere.system.dto.request;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
@ -12,13 +11,12 @@ import java.util.List;
@Data
public class ProjectAddMemberRequest {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{project.id.not_blank}")
private String projectId;
@Schema(description = "用户ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "用户ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{user.ids.not_blank}")
@Valid
private List<
@NotBlank(message = "{user_role_relation.user_id.not_blank}", groups = {Created.class, Updated.class})
String> userIds;