fix(系统设置): UI模块菜单权限控制问题
--bug=1015853 --user=李玉号 【系统设置】没有UI测试 - UI自动化权限的时候,点击UI模块,会跳到个人信息页面 https://www.tapd.cn/55049933/s/1224477
This commit is contained in:
parent
4b4b7c32c8
commit
db7e9a06af
|
@ -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<ReportDTO> recentProjects(@PathVariable int count, @RequestBody ReportRequest request) {
|
||||
// 最近 `count` 个项目
|
||||
PageHelper.startPage(1, count);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 !== '/') {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</div>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/ui" @click="active()" v-if="hasLicense() && check('ui')" onselectstart="return false"
|
||||
v-permission="['PROJECT_UI_SCENARIO:READ','PROJECT_UI_REPORT:READ']">
|
||||
v-permission="['PROJECT_UI_SCENARIO:READ','PROJECT_UI_REPORT:READ', 'PROJECT_UI_ELEMENT:READ']">
|
||||
<div>
|
||||
<svg-icon iconClass="ui" class-name="ms-menu-img"/>
|
||||
<span slot="title" class="ms-menu-item-title">{{ $t('commons.ui') }}</span>
|
||||
|
|
|
@ -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']},
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue