fix: 修复修改项目权限验证的问题

This commit is contained in:
CaptainB 2023-04-13 12:24:47 +08:00
parent dcbd7053aa
commit a5c9d5df7d
2 changed files with 7 additions and 3 deletions

View File

@ -110,10 +110,10 @@ public class ProjectController {
}
@PostMapping("/update")
@MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#Project.id)", content = "#msClass.getLogDetails(#Project.id)", msClass = ProjectService.class)
@MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#project.id)", content = "#msClass.getLogDetails(#project.id)", msClass = ProjectService.class)
@RequiresPermissions(value = {PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_EDIT, PermissionConstants.PROJECT_MANAGER_READ_EDIT}, logical = Logical.OR)
public void updateProject(@RequestBody AddProjectRequest Project) {
projectService.updateProject(Project);
public void updateProject(@RequestBody AddProjectRequest project) {
projectService.updateProject(project);
}
@PostMapping(value = "upload/files/{projectId}", consumes = {"multipart/form-data"})

View File

@ -1,5 +1,6 @@
package io.metersphere.security;
import io.metersphere.base.domain.Project;
import io.metersphere.commons.utils.SessionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@ -41,6 +42,9 @@ public class MsPermissionAnnotationMethodInterceptor extends PermissionAnnotatio
if (StringUtils.isEmpty(projectId) && isExistField(argument, "projectId")) {
projectId = (String) MethodUtils.invokeMethod(argument, "getProjectId");
}
if (StringUtils.equals(parameters[i].getName(), "project") && argument instanceof Project) {
projectId = ((Project) argument).getId();
}
if (StringUtils.isEmpty(workspaceId) && isExistField(argument, "workspaceId")) {
workspaceId = (String) MethodUtils.invokeMethod(argument, "getWorkspaceId");
}