Merge branch 'dev' of https://github.com/metersphere/server into dev
This commit is contained in:
commit
ed556adc59
|
@ -141,8 +141,8 @@ public class UserService {
|
||||||
UserDTO userDTO = new UserDTO();
|
UserDTO userDTO = new UserDTO();
|
||||||
BeanUtils.copyProperties(user, userDTO);
|
BeanUtils.copyProperties(user, userDTO);
|
||||||
UserRoleDTO userRole = getUserRole(userId);
|
UserRoleDTO userRole = getUserRole(userId);
|
||||||
userDTO.setUserRoles(userRole.getUserRoles());
|
userDTO.setUserRoles(Optional.ofNullable(userRole.getUserRoles()).orElse(new ArrayList<>()));
|
||||||
userDTO.setRoles(userRole.getRoles());
|
userDTO.setRoles(Optional.ofNullable(userRole.getRoles()).orElse(new ArrayList<>()));
|
||||||
return userDTO;
|
return userDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,12 @@ import io.metersphere.i18n.Translator;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -135,6 +137,7 @@ public class WorkspaceService {
|
||||||
|
|
||||||
public void checkWorkspaceOwner(String workspaceId) {
|
public void checkWorkspaceOwner(String workspaceId) {
|
||||||
checkWorkspaceIsExist(workspaceId);
|
checkWorkspaceIsExist(workspaceId);
|
||||||
|
int size = 0;
|
||||||
WorkspaceExample example = new WorkspaceExample();
|
WorkspaceExample example = new WorkspaceExample();
|
||||||
SessionUser sessionUser = SessionUtils.getUser();
|
SessionUser sessionUser = SessionUtils.getUser();
|
||||||
UserDTO user = userService.getUserDTO(sessionUser.getId());
|
UserDTO user = userService.getUserDTO(sessionUser.getId());
|
||||||
|
@ -142,15 +145,18 @@ public class WorkspaceService {
|
||||||
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
|
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
|
||||||
.map(UserRole::getSourceId)
|
.map(UserRole::getSourceId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
example.createCriteria()
|
if (!CollectionUtils.isEmpty(orgIds)) {
|
||||||
.andOrganizationIdIn(orgIds)
|
example.createCriteria()
|
||||||
.andIdEqualTo(workspaceId);
|
.andOrganizationIdIn(orgIds)
|
||||||
|
.andIdEqualTo(workspaceId);
|
||||||
|
size = (int) workspaceMapper.countByExample(example);
|
||||||
|
}
|
||||||
List<String> wsIds = user.getUserRoles().stream()
|
List<String> wsIds = user.getUserRoles().stream()
|
||||||
.filter(ur -> RoleConstants.TEST_MANAGER.equals(ur.getRoleId()))
|
.filter(ur -> RoleConstants.TEST_MANAGER.equals(ur.getRoleId()))
|
||||||
.map(UserRole::getSourceId)
|
.map(UserRole::getSourceId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
boolean contains = wsIds.contains(workspaceId);
|
boolean contains = wsIds.contains(workspaceId);
|
||||||
if (workspaceMapper.countByExample(example) == 0 && !contains) {
|
if (size == 0 && !contains) {
|
||||||
MSException.throwException(Translator.get("workspace_does_not_belong_to_user"));
|
MSException.throwException(Translator.get("workspace_does_not_belong_to_user"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,12 +70,12 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="9">
|
<el-col :span="9">
|
||||||
<el-form-item prop="masterUrl" label="Master URL">
|
<el-form-item prop="masterUrl" label="Master URL">
|
||||||
<el-input v-model="item.masterUrl" autocomplete="off"/>
|
<el-input v-model="item.masterUrl" autocomplete="new-password"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="9">
|
<el-col :span="9">
|
||||||
<el-form-item prop="password" label="Token" style="padding-left: 20px">
|
<el-form-item prop="password" label="Token" style="padding-left: 20px">
|
||||||
<el-input v-model="item.token" show-password autocomplete="off"/>
|
<el-input v-model="item.token" autocomplete="new-password"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
|
|
Loading…
Reference in New Issue