From db7e9a06af074c3279e0b38e52a771557f707ba1 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 16 Aug 2022 18:08:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20UI?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=8F=9C=E5=8D=95=E6=9D=83=E9=99=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015853 --user=李玉号 【系统设置】没有UI测试 - UI自动化权限的时候,点击UI模块,会跳到个人信息页面 https://www.tapd.cn/55049933/s/1224477 --- .../performance/controller/PerformanceReportController.java | 3 ++- frontend/src/business/components/common/head/HeaderWs.vue | 3 ++- frontend/src/business/components/common/head/SearchList.vue | 3 ++- frontend/src/business/components/common/router/router.js | 4 +++- frontend/src/business/components/layout/AsideMenus.vue | 2 +- frontend/src/common/js/constants.js | 5 +++++ 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java index af6ebb5794..29833554b2 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java @@ -20,6 +20,7 @@ import io.metersphere.performance.controller.request.RenameReportRequest; import io.metersphere.performance.controller.request.ReportRequest; import io.metersphere.performance.dto.LoadTestExportJmx; import io.metersphere.performance.service.PerformanceReportService; +import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; @@ -35,7 +36,7 @@ public class PerformanceReportController { private PerformanceReportService performanceReportService; @PostMapping("/recent/{count}") - @RequiresPermissions("PROJECT_PERFORMANCE_REPORT:READ") + @RequiresPermissions(value = {"PROJECT_PERFORMANCE_REPORT:READ", "PROJECT_PERFORMANCE_HOME:READ"}, logical = Logical.OR) public List recentProjects(@PathVariable int count, @RequestBody ReportRequest request) { // 最近 `count` 个项目 PageHelper.startPage(1, count); diff --git a/frontend/src/business/components/common/head/HeaderWs.vue b/frontend/src/business/components/common/head/HeaderWs.vue index 4eed30f9fb..33c04e601a 100644 --- a/frontend/src/business/components/common/head/HeaderWs.vue +++ b/frontend/src/business/components/common/head/HeaderWs.vue @@ -98,7 +98,8 @@ export default { if (!redirectUrl) { return '/setting'; } - if (redirectUrl.startsWith("/track") || redirectUrl.startsWith("/performance") || redirectUrl.startsWith("/api")) { + if (redirectUrl.startsWith("/track") || redirectUrl.startsWith("/performance") + || redirectUrl.startsWith("/api") || redirectUrl.startsWith("/ui")) { // 获取有权限的跳转路径 redirectUrl = getDefaultSecondLevelMenu(redirectUrl); } else { diff --git a/frontend/src/business/components/common/head/SearchList.vue b/frontend/src/business/components/common/head/SearchList.vue index 0dd074778f..011182c9e7 100644 --- a/frontend/src/business/components/common/head/SearchList.vue +++ b/frontend/src/business/components/common/head/SearchList.vue @@ -107,7 +107,8 @@ export default { this.reload(); return; } - if (copyRedirectUrl.startsWith("/track") || copyRedirectUrl.startsWith("/performance") || copyRedirectUrl.startsWith("/api")) { + if (copyRedirectUrl.startsWith("/track") || copyRedirectUrl.startsWith("/performance") + || copyRedirectUrl.startsWith("/api") || copyRedirectUrl.startsWith("/ui")) { // 获取有权限的跳转路径 copyRedirectUrl = getDefaultSecondLevelMenu(copyRedirectUrl); if (copyRedirectUrl !== '/') { diff --git a/frontend/src/business/components/common/router/router.js b/frontend/src/business/components/common/router/router.js index 7a13027e9c..19756c6795 100644 --- a/frontend/src/business/components/common/router/router.js +++ b/frontend/src/business/components/common/router/router.js @@ -94,13 +94,15 @@ function redirectLoginPath(originPath, next) { } export function getDefaultSecondLevelMenu(toPath) { - let {TRACK: tracks, API: apis, LOAD: loads} = SECOND_LEVEL_ROUTE_PERMISSION_MAP; + let {TRACK: tracks, API: apis, LOAD: loads, UI: ui} = SECOND_LEVEL_ROUTE_PERMISSION_MAP; if (tracks.map(r => r.router).indexOf(toPath) > -1) { return _getDefaultSecondLevelMenu(tracks, toPath); } else if (apis.map(r => r.router).indexOf(toPath) > -1) { return _getDefaultSecondLevelMenu(apis, toPath); } else if (loads.map(r => r.router).indexOf(toPath) > -1) { return _getDefaultSecondLevelMenu(loads, toPath); + } else if (ui.map(r => r.router).indexOf(toPath) > -1) { + return _getDefaultSecondLevelMenu(ui, toPath); } else { return toPath; } diff --git a/frontend/src/business/components/layout/AsideMenus.vue b/frontend/src/business/components/layout/AsideMenus.vue index 53be193584..624b9bff64 100644 --- a/frontend/src/business/components/layout/AsideMenus.vue +++ b/frontend/src/business/components/layout/AsideMenus.vue @@ -29,7 +29,7 @@ + v-permission="['PROJECT_UI_SCENARIO:READ','PROJECT_UI_REPORT:READ', 'PROJECT_UI_ELEMENT:READ']">
{{ $t('commons.ui') }} diff --git a/frontend/src/common/js/constants.js b/frontend/src/common/js/constants.js index 9e55ea1652..74fe6042c8 100644 --- a/frontend/src/common/js/constants.js +++ b/frontend/src/common/js/constants.js @@ -226,5 +226,10 @@ export const SECOND_LEVEL_ROUTE_PERMISSION_MAP = { {router: '/performance/home', permission: ['PROJECT_PERFORMANCE_HOME:READ']}, {router: '/performance/test/all', permission: ['PROJECT_PERFORMANCE_TEST:READ']}, {router: '/performance/report/all', permission: ['PROJECT_PERFORMANCE_REPORT:READ']}, + ], + UI: [ + {router: '/ui/automation', permission: ['PROJECT_UI_SCENARIO:READ']}, + {router: '/ui/element', permission: ['PROJECT_UI_ELEMENT:READ']}, + {router: '/ui/report', permission: ['PROJECT_UI_REPORT:READ']}, ] }