mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-29 18:48:13 +08:00
fix: fix resourcePool and update userRole
This commit is contained in:
parent
fb81ab845a
commit
50ee81300b
@ -340,11 +340,18 @@ public class TestResourcePoolService {
|
||||
if (testResourcePool == null) {
|
||||
throw new MSException(Translator.get("test_resource_pool_not_exists"));
|
||||
}
|
||||
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||
if (testResourcePool.getEnable()) {
|
||||
testResourcePool.setEnable(false);
|
||||
} else {
|
||||
testResourcePool.setEnable(true);
|
||||
}
|
||||
TestResourcePoolBlob testResourcePoolBlob = testResourcePoolBlobMapper.selectByPrimaryKey(testResourcePoolId);
|
||||
byte[] configuration = testResourcePoolBlob.getConfiguration();
|
||||
String testResourceDTOStr = new String(configuration);
|
||||
TestResourceDTO testResourceDTO = JSON.parseObject(testResourceDTOStr, TestResourceDTO.class);
|
||||
checkApiConfig(testResourceDTO, testResourcePool, testResourcePool.getType());
|
||||
checkLoadConfig(testResourceDTO, testResourcePool, testResourcePool.getType());
|
||||
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song-cc-rock
|
||||
* @author guoyuqi
|
||||
*/
|
||||
@Tag(name = "组织")
|
||||
@Tag(name = "组织-成员")
|
||||
@RestController
|
||||
@RequestMapping("/organization")
|
||||
public class OrganizationController {
|
||||
|
@ -585,7 +585,7 @@ public class OrganizationService {
|
||||
List<String> userRoleInDBInOrgIds = userRoleMap.values().stream().map(UserRole::getId).collect(Collectors.toList());
|
||||
//删除旧的关系
|
||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andUserIdEqualTo(memberId).andRoleIdIn(userRoleInDBInOrgIds);
|
||||
userRoleRelationExample.createCriteria().andUserIdEqualTo(memberId).andSourceIdEqualTo(organizationId);
|
||||
userRoleRelationMapper.deleteByExample(userRoleRelationExample);
|
||||
UserRoleRelationMapper userRoleRelationMapper = sqlSession.getMapper(UserRoleRelationMapper.class);
|
||||
userRoleInDBInOrgIds.forEach(userRoleId -> {
|
||||
|
@ -527,7 +527,10 @@ class TestResourcePoolControllerTests extends BaseTest {
|
||||
@Test
|
||||
@Order(21)
|
||||
void unableTestResourcePoolSuccess() throws Exception {
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/test/resource/pool/set/enable/104")
|
||||
MvcResult testPoolBlob = this.addTestResourcePoolSuccess("test_pool_blob3", false, true, true, false, false, ResourcePoolTypeEnum.K8S.name());
|
||||
TestResourcePool testResourcePoolRequest1 = getResult(testPoolBlob);
|
||||
String id = testResourcePoolRequest1.getId();
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/test/resource/pool/set/enable/"+id)
|
||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||
.header(SessionConstants.CSRF_TOKEN, csrfToken))
|
||||
.andExpect(status().isOk())
|
||||
|
Loading…
Reference in New Issue
Block a user