From a7b0ca8192b018c90140f8b325509442f4e3e7a0 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 13 Apr 2023 12:35:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=9D=83=E9=99=90=E9=AA=8C=E8=AF=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/MsPermissionAnnotationMethodInterceptor.java | 4 ++++ .../java/io/metersphere/controller/ProjectController.java | 6 +++--- .../io/metersphere/controller/SystemProjectController.java | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/security/MsPermissionAnnotationMethodInterceptor.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/security/MsPermissionAnnotationMethodInterceptor.java index 9a452f0ec2..0b8c64f984 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/security/MsPermissionAnnotationMethodInterceptor.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/security/MsPermissionAnnotationMethodInterceptor.java @@ -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"); } diff --git a/project-management/backend/src/main/java/io/metersphere/controller/ProjectController.java b/project-management/backend/src/main/java/io/metersphere/controller/ProjectController.java index 24c7142250..698c16e241 100644 --- a/project-management/backend/src/main/java/io/metersphere/controller/ProjectController.java +++ b/project-management/backend/src/main/java/io/metersphere/controller/ProjectController.java @@ -84,10 +84,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 = BaseProjectService.class) + @MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#project.id)", content = "#msClass.getLogDetails(#project.id)", msClass = BaseProjectService.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("/member/update") diff --git a/system-setting/backend/src/main/java/io/metersphere/controller/SystemProjectController.java b/system-setting/backend/src/main/java/io/metersphere/controller/SystemProjectController.java index ee2c859282..5f16d75ae0 100644 --- a/system-setting/backend/src/main/java/io/metersphere/controller/SystemProjectController.java +++ b/system-setting/backend/src/main/java/io/metersphere/controller/SystemProjectController.java @@ -98,10 +98,10 @@ public class SystemProjectController { } @PostMapping("/update") - @MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#Project.id)", content = "#msClass.getLogDetails(#Project.id)", msClass = BaseProjectService.class) + @MsAuditLog(module = OperLogModule.PROJECT_PROJECT_MANAGER, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#project.id)", content = "#msClass.getLogDetails(#project.id)", msClass = BaseProjectService.class) @RequiresPermissions(value = {PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_EDIT, PermissionConstants.PROJECT_MANAGER_READ_EDIT}, logical = Logical.OR) - public void updateProject(@RequestBody AddProjectRequest Project) { - systemProjectService.updateProject(Project); + public void updateProject(@RequestBody AddProjectRequest project) { + systemProjectService.updateProject(project); } @PostMapping("/member/update")