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();
|
||||
BeanUtils.copyProperties(user, userDTO);
|
||||
UserRoleDTO userRole = getUserRole(userId);
|
||||
userDTO.setUserRoles(userRole.getUserRoles());
|
||||
userDTO.setRoles(userRole.getRoles());
|
||||
userDTO.setUserRoles(Optional.ofNullable(userRole.getUserRoles()).orElse(new ArrayList<>()));
|
||||
userDTO.setRoles(Optional.ofNullable(userRole.getRoles()).orElse(new ArrayList<>()));
|
||||
return userDTO;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,12 @@ import io.metersphere.i18n.Translator;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -135,6 +137,7 @@ public class WorkspaceService {
|
|||
|
||||
public void checkWorkspaceOwner(String workspaceId) {
|
||||
checkWorkspaceIsExist(workspaceId);
|
||||
int size = 0;
|
||||
WorkspaceExample example = new WorkspaceExample();
|
||||
SessionUser sessionUser = SessionUtils.getUser();
|
||||
UserDTO user = userService.getUserDTO(sessionUser.getId());
|
||||
|
@ -142,15 +145,18 @@ public class WorkspaceService {
|
|||
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
|
||||
.map(UserRole::getSourceId)
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(orgIds)) {
|
||||
example.createCriteria()
|
||||
.andOrganizationIdIn(orgIds)
|
||||
.andIdEqualTo(workspaceId);
|
||||
size = (int) workspaceMapper.countByExample(example);
|
||||
}
|
||||
List<String> wsIds = user.getUserRoles().stream()
|
||||
.filter(ur -> RoleConstants.TEST_MANAGER.equals(ur.getRoleId()))
|
||||
.map(UserRole::getSourceId)
|
||||
.collect(Collectors.toList());
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,12 +70,12 @@
|
|||
<el-row>
|
||||
<el-col :span="9">
|
||||
<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-col>
|
||||
<el-col :span="9">
|
||||
<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-col>
|
||||
<el-col :span="6">
|
||||
|
|
Loading…
Reference in New Issue