diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/PermissionAspect.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/PermissionAspect.java index add5f5e012..e7190b0432 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/PermissionAspect.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/PermissionAspect.java @@ -40,6 +40,7 @@ import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; +import org.springframework.expression.spel.SpelEvaluationException; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.stereotype.Component; @@ -77,7 +78,19 @@ public RestResponse permissionAction(ProceedingJoinPoint joinPoint) throws Throw "Permission denied, operations can only be performed with the permissions of the currently logged-in user."); // 2) check team - Long teamId = getId(joinPoint, methodSignature, permission.team()); + Long teamId = null; + try { + teamId = getId(joinPoint, methodSignature, permission.team()); + } catch (SpelEvaluationException e) { + try { + Long appId = getId(joinPoint, methodSignature, permission.app()); + Application app = applicationManageService.getById(appId); + teamId = app.getTeamId(); + } catch (SpelEvaluationException e1) { + log.error( + "Failed to get teamId from permission annotation, please check the annotation configuration."); + } + } if (teamId != null) { Member member = memberService.getByTeamIdUserName(teamId, currentUser.getUsername()); ApiAlertException.throwIfTrue( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java index 6159063e70..a3b159f9ab 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java @@ -202,8 +202,8 @@ public RestResponse readConf(Application app) throws IOException { @PostMapping("main") @Permission(app = "#app.id", team = "#app.teamId") - public RestResponse getMain(Application application) { - String mainClass = applicationInfoService.getMain(application); + public RestResponse getMain(Application app) { + String mainClass = applicationInfoService.getMain(app); return RestResponse.success(mainClass); } @@ -215,16 +215,16 @@ public RestResponse backups(ApplicationBackUp backUp, RestRequest request) { } @PostMapping("opt_log") - @Permission(app = "#log.appId", team = "#log.teamId") + @Permission(app = "#applicationLog.appId") public RestResponse log(ApplicationLog applicationLog, RestRequest request) { IPage applicationList = applicationLogService.getPage(applicationLog, request); return RestResponse.success(applicationList); } - @Permission(app = "#log.appId", team = "#log.teamId") + @Permission(app = "#appId") @PostMapping("delete/opt_log") @RequiresPermissions("app:delete") - public RestResponse deleteLog(Long id) { + public RestResponse deleteLog(Long id, Long appId) { Boolean deleted = applicationLogService.removeById(id); return RestResponse.success(deleted); } diff --git a/streampark-console/streampark-console-webapp/src/api/flink/app.ts b/streampark-console/streampark-console-webapp/src/api/flink/app.ts index 1d034b3a39..74eb61d883 100644 --- a/streampark-console/streampark-console-webapp/src/api/flink/app.ts +++ b/streampark-console/streampark-console-webapp/src/api/flink/app.ts @@ -158,8 +158,8 @@ export function fetchOptionLog(data) { return defHttp.post({ url: APP_API.OPTION_LOG, data }); } -export function fetchDeleteOperationLog(id: string) { - return defHttp.post({ url: APP_API.DELETE_LOG, data: { id } }); +export function fetchDeleteOperationLog(appId: string, id: string) { + return defHttp.post({ url: APP_API.DELETE_LOG, data: { appId, id } }); } /** diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue index 0d3300c6a3..97876987f9 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue +++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue @@ -355,7 +355,7 @@ } async function handleDeleteOperationLog(record: Recordable) { - await fetchDeleteOperationLog(record.id); + await fetchDeleteOperationLog(record.appId, record.id); await reloadOperationLog(); }