fix: 修复权限问题

This commit is contained in:
CaptainB 2023-07-27 13:53:37 +08:00 committed by fit2-zhao
parent d5a6fa980a
commit 366ee0a820
4 changed files with 9 additions and 6 deletions

View File

@ -77,8 +77,8 @@ export function getUserInfo() {
return get(`/user/info`); return get(`/user/info`);
} }
export function getWsAndPj(userId) { export function getWsAndPj() {
return get(`/user/get/ws-pj/${userId}`); return get(`/user/get/ws-pj`);
} }
export function getUserKeys() { export function getUserKeys() {

View File

@ -196,7 +196,7 @@ export default {
}) })
}, },
getWsAndPj() { getWsAndPj() {
getWsAndPj(encodeURIComponent(this.currentUser().id)) getWsAndPj()
.then(response => { .then(response => {
let data = response.data; let data = response.data;
this.workspaceList = data.workspace; this.workspaceList = data.workspace;

View File

@ -5,6 +5,7 @@ import io.metersphere.base.domain.Project;
import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule; import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.constants.PermissionConstants; import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.ProjectDTO; import io.metersphere.dto.ProjectDTO;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.request.ProjectRequest; import io.metersphere.request.ProjectRequest;
@ -30,6 +31,8 @@ public class BaseProjectController {
*/ */
@PostMapping("/list/related") @PostMapping("/list/related")
public List<Project> getUserProject(@RequestBody ProjectRequest request) { public List<Project> getUserProject(@RequestBody ProjectRequest request) {
// 仅支持查询当前用户的项目
request.setUserId(SessionUtils.getUserId());
return baseProjectService.getUserProject(request); return baseProjectService.getUserProject(request);
} }

View File

@ -110,9 +110,9 @@ public class BaseUserController {
/** /**
* 根据userId 获取 user 所属工作空间和所属工作项目 * 根据userId 获取 user 所属工作空间和所属工作项目
*/ */
@GetMapping("/get/ws-pj/{userId}") @GetMapping("/get/ws-pj")
public Map<Object, Object> getWSAndProjectByUserId(@PathVariable String userId) { public Map<Object, Object> getWSAndProjectByUserId() {
return baseUserService.getWSAndProjectByUserId(userId); return baseUserService.getWSAndProjectByUserId(SessionUtils.getUserId());
} }