refactor(系统设置): 组织用户组功能
This commit is contained in:
parent
df20aec81a
commit
226b9840d6
|
@ -65,6 +65,11 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'o
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER:READ');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER:READ');
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+CUSTOM');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+CUSTOM');
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER:READ+ADD');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER:READ+ADD');
|
||||||
|
-- 初始化组织-用户组菜单权限(默认)
|
||||||
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER_ROLE:READ');
|
||||||
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER_ROLE:READ+ADD');
|
||||||
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER_ROLE:READ+UPDATE');
|
||||||
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_admin', 'ORGANIZATION_USER_ROLE:READ+DELETE');
|
||||||
-- 组织成员权限
|
-- 组织成员权限
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_member', 'ORGANIZATION_PROJECT_MANAGER:READ+UPLOAD_JAR');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_member', 'ORGANIZATION_PROJECT_MANAGER:READ+UPLOAD_JAR');
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_member', 'ORGANIZATION_MESSAGE:READ');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (uuid(), 'org_member', 'ORGANIZATION_MESSAGE:READ');
|
||||||
|
|
|
@ -19,6 +19,8 @@ import io.metersphere.system.request.OrganizationUserRoleMemberRequest;
|
||||||
import io.metersphere.system.service.OrganizationUserRoleLogService;
|
import io.metersphere.system.service.OrganizationUserRoleLogService;
|
||||||
import io.metersphere.system.service.OrganizationUserRoleService;
|
import io.metersphere.system.service.OrganizationUserRoleService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
@ -40,6 +42,7 @@ public class OrganizationUserRoleController {
|
||||||
|
|
||||||
@GetMapping("/list/{organizationId}")
|
@GetMapping("/list/{organizationId}")
|
||||||
@Operation(summary = "获取组织用户组列表")
|
@Operation(summary = "获取组织用户组列表")
|
||||||
|
@Parameter(name = "organizationId", description = "当前组织ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
|
||||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_USER_ROLE_READ)
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_USER_ROLE_READ)
|
||||||
public List<UserRole> list(@PathVariable String organizationId) {
|
public List<UserRole> list(@PathVariable String organizationId) {
|
||||||
return organizationUserRoleService.list(organizationId);
|
return organizationUserRoleService.list(organizationId);
|
||||||
|
@ -69,6 +72,7 @@ public class OrganizationUserRoleController {
|
||||||
@GetMapping("/delete/{id}")
|
@GetMapping("/delete/{id}")
|
||||||
@Operation(summary = "删除组织用户组")
|
@Operation(summary = "删除组织用户组")
|
||||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_USER_ROLE_READ_DELETE)
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_USER_ROLE_READ_DELETE)
|
||||||
|
@Parameter(name = "id", description = "用户组ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
|
||||||
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = OrganizationUserRoleLogService.class)
|
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = OrganizationUserRoleLogService.class)
|
||||||
public void delete(@PathVariable String id) {
|
public void delete(@PathVariable String id) {
|
||||||
organizationUserRoleService.delete(id);
|
organizationUserRoleService.delete(id);
|
||||||
|
@ -76,6 +80,7 @@ public class OrganizationUserRoleController {
|
||||||
|
|
||||||
@GetMapping("/permission/setting/{id}")
|
@GetMapping("/permission/setting/{id}")
|
||||||
@Operation(summary = "获取组织用户组对应的权限配置")
|
@Operation(summary = "获取组织用户组对应的权限配置")
|
||||||
|
@Parameter(name = "id", description = "用户组ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
|
||||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_USER_ROLE_READ)
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_USER_ROLE_READ)
|
||||||
public List<PermissionDefinitionItem> getPermissionSetting(@PathVariable String id) {
|
public List<PermissionDefinitionItem> getPermissionSetting(@PathVariable String id) {
|
||||||
return organizationUserRoleService.getPermissionSetting(id);
|
return organizationUserRoleService.getPermissionSetting(id);
|
||||||
|
|
|
@ -38,9 +38,7 @@
|
||||||
urr.source_id = #{request.organizationId}
|
urr.source_id = #{request.organizationId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.keyword != null">
|
<if test="request.keyword != null">
|
||||||
and (u.name like CONCAT('%', #{request.keyword},'%')
|
and u.name like concat('%', #{request.keyword},'%')
|
||||||
or u.email like CONCAT('%', #{request.keyword},'%')
|
|
||||||
or u.phone like CONCAT('%', #{request.keyword},'%'))
|
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by u.update_time desc
|
order by u.update_time desc
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
select u.* from user_role_relation urr left join user u on urr.user_id = u.id
|
select u.* from user_role_relation urr left join user u on urr.user_id = u.id
|
||||||
where urr.source_id = #{request.organizationId}
|
where urr.source_id = #{request.organizationId}
|
||||||
and urr.role_id = #{request.userRoleId}
|
and urr.role_id = #{request.userRoleId}
|
||||||
and u.name like concat('%',#{request.userName},'%')
|
and u.name like concat('%',#{request.userKeyWord},'%')
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -13,4 +13,6 @@ public interface ExtUserRoleRelationMapper {
|
||||||
List<UserRoleRelation> selectGlobalRoleByUserId(String userId);
|
List<UserRoleRelation> selectGlobalRoleByUserId(String userId);
|
||||||
|
|
||||||
List<UserRoleRelationUserDTO> listGlobal(@Param("request") GlobalUserRoleRelationQueryRequest request);
|
List<UserRoleRelationUserDTO> listGlobal(@Param("request") GlobalUserRoleRelationQueryRequest request);
|
||||||
|
|
||||||
|
void batchInsert(@Param("list") List<UserRoleRelation> list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,4 +30,12 @@
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="batchInsert" parameterType="java.util.List">
|
||||||
|
insert into user_role_relation (id, user_id, role_id, source_id, create_time, create_user)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator="," >
|
||||||
|
(#{item.id}, #{item.userId}, #{item.roleId}, #{item.sourceId}, #{item.createTime}, #{item.createUser})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.system.request;
|
package io.metersphere.system.request;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ -8,6 +9,7 @@ import java.io.Serializable;
|
||||||
* @author song-cc-rock
|
* @author song-cc-rock
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationDeleteRequest implements Serializable {
|
public class OrganizationDeleteRequest implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,11 +7,13 @@ import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationEditRequest implements Serializable {
|
public class OrganizationEditRequest implements Serializable {
|
||||||
|
|
||||||
@Schema(title = "组织ID")
|
@Schema(title = "组织ID")
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package io.metersphere.system.request;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class OrganizationMemberBatchRequest extends OrganizationMemberRequest{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织ID集合
|
||||||
|
*/
|
||||||
|
@Schema(title = "组织ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "{organization.id.not_blank}")
|
||||||
|
private List<String> organizationIds;
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package io.metersphere.system.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ import java.util.List;
|
||||||
* @author guoyuqi
|
* @author guoyuqi
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationMemberExtendRequest extends OrganizationMemberRequest {
|
public class OrganizationMemberExtendRequest extends OrganizationMemberRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,6 +13,7 @@ import java.util.List;
|
||||||
* @author song-cc-rock
|
* @author song-cc-rock
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationMemberRequest implements Serializable {
|
public class OrganizationMemberRequest implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +26,7 @@ public class OrganizationMemberRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 成员ID集合
|
* 成员ID集合
|
||||||
*/
|
*/
|
||||||
@Schema(title = "成员ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "成员ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotEmpty(message = "{member.id.not_null}")
|
@NotEmpty(message = "{user.id.not_blank}")
|
||||||
private List<String> memberIds;
|
private List<String> memberIds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationUserRoleEditRequest implements Serializable {
|
public class OrganizationUserRoleEditRequest implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -2,12 +2,16 @@ package io.metersphere.system.request;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationUserRoleMemberEditRequest implements Serializable {
|
public class OrganizationUserRoleMemberEditRequest implements Serializable {
|
||||||
|
|
||||||
@Schema(title = "组ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "组ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ -20,8 +24,7 @@ public class OrganizationUserRoleMemberEditRequest implements Serializable {
|
||||||
@Size(min = 1, max = 50, message = "{organization.id.length_range}")
|
@Size(min = 1, max = 50, message = "{organization.id.length_range}")
|
||||||
private String organizationId;
|
private String organizationId;
|
||||||
|
|
||||||
@Schema(title = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "成员ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{user.id.not_blank}")
|
@NotEmpty(message = "{user.id.not_blank}")
|
||||||
@Size(min = 1, max = 50, message = "{user.id.length_range}")
|
private List<String> userIds;
|
||||||
private String userId;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OrganizationUserRoleMemberRequest extends BasePageRequest {
|
public class OrganizationUserRoleMemberRequest extends BasePageRequest {
|
||||||
|
|
||||||
@Schema(title = "组ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "组ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ -21,6 +21,6 @@ public class OrganizationUserRoleMemberRequest extends BasePageRequest {
|
||||||
@Size(min = 1, max = 50, message = "{organization.id.length_range}")
|
@Size(min = 1, max = 50, message = "{organization.id.length_range}")
|
||||||
private String organizationId;
|
private String organizationId;
|
||||||
|
|
||||||
@Schema(title = "用户名")
|
@Schema(title = "搜索关键字")
|
||||||
private String userName;
|
private String userKeyWord;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,7 @@ import io.metersphere.system.dto.OrganizationDTO;
|
||||||
import io.metersphere.system.dto.OrganizationProjectOptionsDto;
|
import io.metersphere.system.dto.OrganizationProjectOptionsDto;
|
||||||
import io.metersphere.system.dto.UserExtend;
|
import io.metersphere.system.dto.UserExtend;
|
||||||
import io.metersphere.system.mapper.*;
|
import io.metersphere.system.mapper.*;
|
||||||
import io.metersphere.system.request.OrgMemberExtendProjectRequest;
|
import io.metersphere.system.request.*;
|
||||||
import io.metersphere.system.request.OrganizationMemberExtendRequest;
|
|
||||||
import io.metersphere.system.request.OrganizationMemberRequest;
|
|
||||||
import io.metersphere.system.request.OrganizationRequest;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
@ -47,13 +44,15 @@ import java.util.stream.Collectors;
|
||||||
public class OrganizationService {
|
public class OrganizationService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
OrganizationMapper organizationMapper;
|
private OrganizationMapper organizationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
ExtOrganizationMapper extOrganizationMapper;
|
private ExtOrganizationMapper extOrganizationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
UserRoleRelationMapper userRoleRelationMapper;
|
private UserRoleRelationMapper userRoleRelationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
UserMapper userMapper;
|
private ExtUserRoleRelationMapper extUserRoleRelationMapper;
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private SqlSessionFactory sqlSessionFactory;
|
private SqlSessionFactory sqlSessionFactory;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -86,20 +85,26 @@ public class OrganizationService {
|
||||||
return extOrganizationMapper.listMember(request);
|
return extOrganizationMapper.listMember(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addMemberBySystem(OrganizationMemberRequest organizationMemberRequest, String createUserId) {
|
public void addMemberBySystem(OrganizationMemberRequest organizationMemberRequest, String createUserId) {
|
||||||
String organizationId = organizationMemberRequest.getOrganizationId();
|
OrganizationMemberBatchRequest batchRequest = new OrganizationMemberBatchRequest();
|
||||||
checkOrgExist(organizationId);
|
batchRequest.setOrganizationIds(List.of(organizationMemberRequest.getOrganizationId()));
|
||||||
Map<String, User> userMap = checkUserExist(organizationMemberRequest.getMemberIds());
|
batchRequest.setMemberIds(organizationMemberRequest.getMemberIds());
|
||||||
for (String userId : organizationMemberRequest.getMemberIds()) {
|
addMemberBySystem(batchRequest, createUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMemberBySystem(OrganizationMemberBatchRequest batchRequest, String createUserId) {
|
||||||
|
checkOrgExist(batchRequest.getOrganizationIds());
|
||||||
|
Map<String, User> userMap = checkUserExist(batchRequest.getMemberIds());
|
||||||
|
List<UserRoleRelation> userRoleRelations = new ArrayList<>();
|
||||||
|
batchRequest.getOrganizationIds().forEach(organizationId -> {
|
||||||
|
for (String userId : batchRequest.getMemberIds()) {
|
||||||
if (userMap.get(userId) == null) {
|
if (userMap.get(userId) == null) {
|
||||||
throw new MSException("id:" + userId + Translator.get("user.not.exist"));
|
throw new MSException("id:" + userId + Translator.get("user.not.exist"));
|
||||||
}
|
}
|
||||||
//过滤已存在的关系
|
//组织用户成员关系已存在, 不再重复添加
|
||||||
UserRoleRelationExample example = new UserRoleRelationExample();
|
UserRoleRelationExample example = new UserRoleRelationExample();
|
||||||
example.createCriteria().andSourceIdEqualTo(organizationId).andUserIdEqualTo(userId).andRoleIdEqualTo(InternalUserRole.ORG_MEMBER.getValue());
|
example.createCriteria().andSourceIdEqualTo(organizationId).andUserIdEqualTo(userId).andRoleIdEqualTo(InternalUserRole.ORG_MEMBER.getValue());
|
||||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(example);
|
if (userRoleRelationMapper.countByExample(example) > 0) {
|
||||||
if (CollectionUtils.isNotEmpty(userRoleRelations)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
|
@ -109,7 +114,11 @@ public class OrganizationService {
|
||||||
userRoleRelation.setRoleId(InternalUserRole.ORG_MEMBER.getValue());
|
userRoleRelation.setRoleId(InternalUserRole.ORG_MEMBER.getValue());
|
||||||
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
userRoleRelation.setCreateUser(createUserId);
|
userRoleRelation.setCreateUser(createUserId);
|
||||||
userRoleRelationMapper.insert(userRoleRelation);
|
userRoleRelations.add(userRoleRelation);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (CollectionUtils.isNotEmpty(userRoleRelations)) {
|
||||||
|
extUserRoleRelationMapper.batchInsert(userRoleRelations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +182,7 @@ public class OrganizationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMember(String organizationId, String userId) {
|
public void removeMember(String organizationId, String userId) {
|
||||||
checkOrgExist(organizationId);
|
checkOrgExist(List.of(organizationId));
|
||||||
//删除组织下项目与成员的关系
|
//删除组织下项目与成员的关系
|
||||||
List<String> projectIds = getProjectIds(organizationId);
|
List<String> projectIds = getProjectIds(organizationId);
|
||||||
if (CollectionUtils.isNotEmpty(projectIds)) {
|
if (CollectionUtils.isNotEmpty(projectIds)) {
|
||||||
|
@ -203,33 +212,12 @@ public class OrganizationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMemberByOrg(OrganizationMemberExtendRequest organizationMemberExtendRequest, String createUserId) {
|
public void addMemberByOrg(OrganizationMemberExtendRequest organizationMemberExtendRequest, String createUserId) {
|
||||||
checkOrgExist(organizationMemberExtendRequest.getOrganizationId());
|
checkOrgExist(List.of(organizationMemberExtendRequest.getOrganizationId()));
|
||||||
Map<String, User> userMap = checkUserExist(organizationMemberExtendRequest.getMemberIds());
|
Map<String, User> userMap = checkUserExist(organizationMemberExtendRequest.getMemberIds());
|
||||||
Map<String, UserRole> userRoleMap = checkUseRoleExist(organizationMemberExtendRequest.getUserRoleIds());
|
Map<String, UserRole> userRoleMap = checkUseRoleExist(organizationMemberExtendRequest.getUserRoleIds());
|
||||||
setRelationByMemberAndGroupIds(organizationMemberExtendRequest, createUserId, userMap, userRoleMap, true);
|
setRelationByMemberAndGroupIds(organizationMemberExtendRequest, createUserId, userMap, userRoleMap, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, UserRole> checkUseRoleExist(List<String> userRoleIds) {
|
|
||||||
UserRoleExample userRoleExample = new UserRoleExample();
|
|
||||||
userRoleExample.createCriteria().andIdIn(userRoleIds).andTypeEqualTo("ORGANIZATION");
|
|
||||||
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
|
|
||||||
if (CollectionUtils.isEmpty(userRoles)) {
|
|
||||||
throw new MSException(Translator.get("user_role_not_exist"));
|
|
||||||
}
|
|
||||||
return userRoles.stream().collect(Collectors.toMap(UserRole::getId, user -> user));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, User> checkUserExist(List<String> memberIds) {
|
|
||||||
UserExample userExample = new UserExample();
|
|
||||||
userExample.createCriteria().andIdIn(memberIds);
|
|
||||||
List<User> users = userMapper.selectByExample(userExample);
|
|
||||||
if (CollectionUtils.isEmpty(users)) {
|
|
||||||
throw new MSException(Translator.get("user.not.exist"));
|
|
||||||
}
|
|
||||||
return users.stream().collect(Collectors.toMap(User::getId, user -> user));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setRelationByMemberAndGroupIds(OrganizationMemberExtendRequest organizationMemberExtendRequest, String createUserId, Map<String, User> userMap, Map<String, UserRole> userRoleMap, boolean add) {
|
private void setRelationByMemberAndGroupIds(OrganizationMemberExtendRequest organizationMemberExtendRequest, String createUserId, Map<String, User> userMap, Map<String, UserRole> userRoleMap, boolean add) {
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
UserRoleRelationMapper userRoleRelationMapper = sqlSession.getMapper(UserRoleRelationMapper.class);
|
UserRoleRelationMapper userRoleRelationMapper = sqlSession.getMapper(UserRoleRelationMapper.class);
|
||||||
|
@ -285,23 +273,16 @@ public class OrganizationService {
|
||||||
|
|
||||||
public void updateMemberRole(OrganizationMemberExtendRequest organizationMemberExtendRequest, String userId) {
|
public void updateMemberRole(OrganizationMemberExtendRequest organizationMemberExtendRequest, String userId) {
|
||||||
String organizationId = organizationMemberExtendRequest.getOrganizationId();
|
String organizationId = organizationMemberExtendRequest.getOrganizationId();
|
||||||
checkOrgExist(organizationId);
|
checkOrgExist(List.of(organizationId));
|
||||||
Map<String, User> userMap = checkUserExist(organizationMemberExtendRequest.getMemberIds());
|
Map<String, User> userMap = checkUserExist(organizationMemberExtendRequest.getMemberIds());
|
||||||
Map<String, UserRole> userRoleMap = checkUseRoleExist(organizationMemberExtendRequest.getUserRoleIds());
|
Map<String, UserRole> userRoleMap = checkUseRoleExist(organizationMemberExtendRequest.getUserRoleIds());
|
||||||
//在新增组织成员与用户组和组织的关系
|
//在新增组织成员与用户组和组织的关系
|
||||||
setRelationByMemberAndGroupIds(organizationMemberExtendRequest, userId, userMap, userRoleMap, false);
|
setRelationByMemberAndGroupIds(organizationMemberExtendRequest, userId, userMap, userRoleMap, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkOrgExist(String organizationId) {
|
|
||||||
Organization organization = organizationMapper.selectByPrimaryKey(organizationId);
|
|
||||||
if (organization == null) {
|
|
||||||
throw new MSException(Translator.get("organization_not_exist"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMemberToProject(OrgMemberExtendProjectRequest orgMemberExtendProjectRequest, String userId) {
|
public void addMemberToProject(OrgMemberExtendProjectRequest orgMemberExtendProjectRequest, String userId) {
|
||||||
String requestOrganizationId = orgMemberExtendProjectRequest.getOrganizationId();
|
String requestOrganizationId = orgMemberExtendProjectRequest.getOrganizationId();
|
||||||
checkOrgExist(requestOrganizationId);
|
checkOrgExist(List.of(requestOrganizationId));
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
UserRoleRelationMapper userRoleRelationMapper = sqlSession.getMapper(UserRoleRelationMapper.class);
|
UserRoleRelationMapper userRoleRelationMapper = sqlSession.getMapper(UserRoleRelationMapper.class);
|
||||||
List<LogDTO> logDTOList = new ArrayList<>();
|
List<LogDTO> logDTOList = new ArrayList<>();
|
||||||
|
@ -340,8 +321,7 @@ public class OrganizationService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除组织用户日志
|
* 删除组织用户日志
|
||||||
*
|
* @return 日志内容
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<LogDTO> batchDelLog(String organizationId, String userId) {
|
public List<LogDTO> batchDelLog(String organizationId, String userId) {
|
||||||
List<String> projectIds = getProjectIds(organizationId);
|
List<String> projectIds = getProjectIds(organizationId);
|
||||||
|
@ -405,7 +385,7 @@ public class OrganizationService {
|
||||||
List<String> memberIds = organizationMemberExtendRequest.getMemberIds();
|
List<String> memberIds = organizationMemberExtendRequest.getMemberIds();
|
||||||
|
|
||||||
//校验组织是否存在
|
//校验组织是否存在
|
||||||
checkOrgExist(organizationId);
|
checkOrgExist(List.of(organizationId));
|
||||||
//校验成员是否是当前组织的成员
|
//校验成员是否是当前组织的成员
|
||||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||||
userRoleRelationExample.createCriteria().andUserIdIn(memberIds).andSourceIdEqualTo(organizationId);
|
userRoleRelationExample.createCriteria().andUserIdIn(memberIds).andSourceIdEqualTo(organizationId);
|
||||||
|
@ -444,4 +424,33 @@ public class OrganizationService {
|
||||||
//写入操作日志
|
//写入操作日志
|
||||||
operationLogService.batchAdd(logDTOList);
|
operationLogService.batchAdd(logDTOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkOrgExist(List<String> organizationIds) {
|
||||||
|
OrganizationExample example = new OrganizationExample();
|
||||||
|
example.createCriteria().andIdIn(organizationIds);
|
||||||
|
if (organizationMapper.countByExample(example) < organizationIds.size()) {
|
||||||
|
throw new MSException(Translator.get("organization_not_exist"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, UserRole> checkUseRoleExist(List<String> userRoleIds) {
|
||||||
|
UserRoleExample userRoleExample = new UserRoleExample();
|
||||||
|
userRoleExample.createCriteria().andIdIn(userRoleIds).andTypeEqualTo("ORGANIZATION");
|
||||||
|
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
|
||||||
|
if (CollectionUtils.isEmpty(userRoles)) {
|
||||||
|
throw new MSException(Translator.get("user_role_not_exist"));
|
||||||
|
}
|
||||||
|
return userRoles.stream().collect(Collectors.toMap(UserRole::getId, user -> user));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, User> checkUserExist(List<String> memberIds) {
|
||||||
|
UserExample userExample = new UserExample();
|
||||||
|
userExample.createCriteria().andIdIn(memberIds);
|
||||||
|
List<User> users = userMapper.selectByExample(userExample);
|
||||||
|
if (CollectionUtils.isEmpty(users)) {
|
||||||
|
throw new MSException(Translator.get("user.not.exist"));
|
||||||
|
}
|
||||||
|
return users.stream().collect(Collectors.toMap(User::getId, user -> user));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,21 +85,24 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMember(OrganizationUserRoleMemberEditRequest request, String createUserId) {
|
public void addMember(OrganizationUserRoleMemberEditRequest request, String createUserId) {
|
||||||
checkMemberParam(request.getUserId(), request.getUserRoleId());
|
request.getUserIds().forEach(userId -> {
|
||||||
|
checkMemberParam(userId, request.getUserRoleId());
|
||||||
UserRoleRelation relation = new UserRoleRelation();
|
UserRoleRelation relation = new UserRoleRelation();
|
||||||
relation.setId(UUID.randomUUID().toString());
|
relation.setId(UUID.randomUUID().toString());
|
||||||
relation.setUserId(request.getUserId());
|
relation.setUserId(userId);
|
||||||
relation.setRoleId(request.getUserRoleId());
|
relation.setRoleId(request.getUserRoleId());
|
||||||
relation.setSourceId(request.getOrganizationId());
|
relation.setSourceId(request.getOrganizationId());
|
||||||
relation.setCreateTime(System.currentTimeMillis());
|
relation.setCreateTime(System.currentTimeMillis());
|
||||||
relation.setCreateUser(createUserId);
|
relation.setCreateUser(createUserId);
|
||||||
userRoleRelationMapper.insert(relation);
|
userRoleRelationMapper.insert(relation);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMember(OrganizationUserRoleMemberEditRequest request) {
|
public void removeMember(OrganizationUserRoleMemberEditRequest request) {
|
||||||
checkMemberParam(request.getUserId(), request.getUserRoleId());
|
String removeUserId = request.getUserIds().get(0);
|
||||||
|
checkMemberParam(removeUserId, request.getUserRoleId());
|
||||||
UserRoleRelationExample example = new UserRoleRelationExample();
|
UserRoleRelationExample example = new UserRoleRelationExample();
|
||||||
example.createCriteria().andUserIdEqualTo(request.getUserId())
|
example.createCriteria().andUserIdEqualTo(removeUserId)
|
||||||
.andRoleIdEqualTo(request.getUserRoleId())
|
.andRoleIdEqualTo(request.getUserRoleId())
|
||||||
.andSourceIdEqualTo(request.getOrganizationId());
|
.andSourceIdEqualTo(request.getOrganizationId());
|
||||||
userRoleRelationMapper.deleteByExample(example);
|
userRoleRelationMapper.deleteByExample(example);
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
OrganizationUserRoleMemberRequest request = new OrganizationUserRoleMemberRequest();
|
OrganizationUserRoleMemberRequest request = new OrganizationUserRoleMemberRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserRoleId("default-org-role-id-3");
|
request.setUserRoleId("default-org-role-id-3");
|
||||||
request.setUserName("admin");
|
request.setKeyword("admin");
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
MvcResult mvcResult = this.responsePost(ORGANIZATION_USER_ROLE_LIST_MEMBER, request);
|
MvcResult mvcResult = this.responsePost(ORGANIZATION_USER_ROLE_LIST_MEMBER, request);
|
||||||
|
@ -287,8 +287,8 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
|
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
|
||||||
if(CollectionUtils.isNotEmpty(userList)) {
|
if(CollectionUtils.isNotEmpty(userList)) {
|
||||||
User user = userList.get(0);
|
User user = userList.get(0);
|
||||||
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getUserName())
|
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword())
|
||||||
|| StringUtils.contains(user.getId(), request.getUserName()));
|
|| StringUtils.contains(user.getId(), request.getKeyword()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserRoleId("default-org-role-id-3");
|
request.setUserRoleId("default-org-role-id-3");
|
||||||
request.setUserId("admin");
|
request.setUserIds(List.of("admin"));
|
||||||
this.requestPost(ORGANIZATION_USER_ROLE_ADD_MEMBER, request, status().isOk());
|
this.requestPost(ORGANIZATION_USER_ROLE_ADD_MEMBER, request, status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,13 +326,13 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
public void testOrganizationUserRoleAddMemberError() throws Exception {
|
public void testOrganizationUserRoleAddMemberError() throws Exception {
|
||||||
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserId("admin-x");
|
request.setUserIds(List.of("admin-x"));
|
||||||
request.setUserRoleId("default-org-role-id-3");
|
request.setUserRoleId("default-org-role-id-3");
|
||||||
// 用户不存在
|
// 用户不存在
|
||||||
this.requestPost(ORGANIZATION_USER_ROLE_ADD_MEMBER, request, status().is5xxServerError());
|
this.requestPost(ORGANIZATION_USER_ROLE_ADD_MEMBER, request, status().is5xxServerError());
|
||||||
request = new OrganizationUserRoleMemberEditRequest();
|
request = new OrganizationUserRoleMemberEditRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserId("admin");
|
request.setUserIds(List.of("admin"));
|
||||||
request.setUserRoleId("default-org-role-id-x");
|
request.setUserRoleId("default-org-role-id-x");
|
||||||
// 用户组不存在
|
// 用户组不存在
|
||||||
this.requestPost(ORGANIZATION_USER_ROLE_ADD_MEMBER, request, status().is5xxServerError());
|
this.requestPost(ORGANIZATION_USER_ROLE_ADD_MEMBER, request, status().is5xxServerError());
|
||||||
|
@ -344,7 +344,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserRoleId("default-org-role-id-3");
|
request.setUserRoleId("default-org-role-id-3");
|
||||||
request.setUserId("admin");
|
request.setUserIds(List.of("admin"));
|
||||||
this.requestPost(ORGANIZATION_USER_ROLE_REMOVE_MEMBER, request, status().isOk());
|
this.requestPost(ORGANIZATION_USER_ROLE_REMOVE_MEMBER, request, status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,13 +353,13 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
||||||
public void testOrganizationUserRoleRemoveMemberError() throws Exception {
|
public void testOrganizationUserRoleRemoveMemberError() throws Exception {
|
||||||
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
OrganizationUserRoleMemberEditRequest request = new OrganizationUserRoleMemberEditRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserId("admin-x");
|
request.setUserIds(List.of("admin-x"));
|
||||||
request.setUserRoleId("default-org-role-id-3");
|
request.setUserRoleId("default-org-role-id-3");
|
||||||
// 用户不存在
|
// 用户不存在
|
||||||
this.requestPost(ORGANIZATION_USER_ROLE_REMOVE_MEMBER, request, status().is5xxServerError());
|
this.requestPost(ORGANIZATION_USER_ROLE_REMOVE_MEMBER, request, status().is5xxServerError());
|
||||||
request = new OrganizationUserRoleMemberEditRequest();
|
request = new OrganizationUserRoleMemberEditRequest();
|
||||||
request.setOrganizationId("default-organization-2");
|
request.setOrganizationId("default-organization-2");
|
||||||
request.setUserId("admin");
|
request.setUserIds(List.of("admin"));
|
||||||
request.setUserRoleId("default-org-role-id-x");
|
request.setUserRoleId("default-org-role-id-x");
|
||||||
// 用户组不存在
|
// 用户组不存在
|
||||||
this.requestPost(ORGANIZATION_USER_ROLE_REMOVE_MEMBER, request, status().is5xxServerError());
|
this.requestPost(ORGANIZATION_USER_ROLE_REMOVE_MEMBER, request, status().is5xxServerError());
|
||||||
|
|
|
@ -25,10 +25,7 @@ import org.springframework.test.web.servlet.ResultMatcher;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||||
|
@ -210,7 +207,7 @@ public class SystemOrganizationControllerTests extends BaseTest{
|
||||||
public void testAddOrganizationMemberSuccess() throws Exception {
|
public void testAddOrganizationMemberSuccess() throws Exception {
|
||||||
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
||||||
organizationMemberRequest.setOrganizationId("default-organization-3");
|
organizationMemberRequest.setOrganizationId("default-organization-3");
|
||||||
organizationMemberRequest.setMemberIds(Arrays.asList("admin", "default-admin"));
|
organizationMemberRequest.setMemberIds(List.of("admin", "default-admin"));
|
||||||
this.requestPost(ORGANIZATION_ADD_MEMBER, organizationMemberRequest, status().isOk());
|
this.requestPost(ORGANIZATION_ADD_MEMBER, organizationMemberRequest, status().isOk());
|
||||||
// 批量添加成员成功后, 验证是否添加成功
|
// 批量添加成员成功后, 验证是否添加成功
|
||||||
OrganizationRequest organizationRequest = new OrganizationRequest();
|
OrganizationRequest organizationRequest = new OrganizationRequest();
|
||||||
|
@ -243,7 +240,7 @@ public class SystemOrganizationControllerTests extends BaseTest{
|
||||||
public void testAddOrganizationMemberSuccessWithRepeatUser() throws Exception {
|
public void testAddOrganizationMemberSuccessWithRepeatUser() throws Exception {
|
||||||
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
OrganizationMemberRequest organizationMemberRequest = new OrganizationMemberRequest();
|
||||||
organizationMemberRequest.setOrganizationId("default-organization-3");
|
organizationMemberRequest.setOrganizationId("default-organization-3");
|
||||||
organizationMemberRequest.setMemberIds(Arrays.asList("admin", "admin","default-admin"));
|
organizationMemberRequest.setMemberIds(List.of("admin"));
|
||||||
this.requestPost(ORGANIZATION_ADD_MEMBER, organizationMemberRequest, status().isOk());
|
this.requestPost(ORGANIZATION_ADD_MEMBER, organizationMemberRequest, status().isOk());
|
||||||
// 批量添加成员成功后, 验证是否添加成功
|
// 批量添加成员成功后, 验证是否添加成功
|
||||||
OrganizationRequest organizationRequest = new OrganizationRequest();
|
OrganizationRequest organizationRequest = new OrganizationRequest();
|
||||||
|
|
Loading…
Reference in New Issue