fix(用户组与权限): 修复只有工作空间权限的时候跳转到系统页面
--bug=1008003 --user=刘瑞斌 【用户组和权限】-仅有一个工作空间成员和项目管理员权限的用户不应该显示系统数据信息(图2) https://www.tapd.cn/55049933/s/1070878
This commit is contained in:
parent
bd1ff2ccd4
commit
70bd961020
|
@ -15,7 +15,7 @@
|
|||
<!-- float right -->
|
||||
<ms-user ref="headerUser"/>
|
||||
<ms-language-switch :color="color"/>
|
||||
<ms-header-org-ws :color="color"/>
|
||||
<ms-header-ws :color="color"/>
|
||||
<ms-task-center :color="color"/>
|
||||
<ms-notification :color="color"/>
|
||||
</el-col>
|
||||
|
@ -31,7 +31,7 @@
|
|||
import MsTopMenus from "./components/common/head/HeaderTopMenus";
|
||||
import MsView from "./components/common/router/View";
|
||||
import MsUser from "./components/common/head/HeaderUser";
|
||||
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
|
||||
import MsHeaderWs from "./components/common/head/HeaderWs";
|
||||
import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
|
||||
import {hasLicense, saveLocalStorage, setColor, setDefaultTheme} from "@/common/js/utils";
|
||||
import {registerRequestHeaders} from "@/common/js/ajax";
|
||||
|
@ -199,7 +199,7 @@ export default {
|
|||
MsUser,
|
||||
MsView,
|
||||
MsTopMenus,
|
||||
MsHeaderOrgWs,
|
||||
MsHeaderWs,
|
||||
"LicenseMessage": header.default,
|
||||
"Theme": theme.default
|
||||
}
|
||||
|
|
|
@ -31,14 +31,14 @@
|
|||
import {
|
||||
fullScreenLoading,
|
||||
getCurrentUser,
|
||||
getCurrentWorkspaceId,
|
||||
getCurrentWorkspaceId, hasPermissions,
|
||||
saveLocalStorage,
|
||||
stopFullScreenLoading
|
||||
} from "@/common/js/utils";
|
||||
import {ORGANIZATION_ID, PROJECT_ID, WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {PROJECT_ID, WORKSPACE_ID} from "@/common/js/constants";
|
||||
|
||||
export default {
|
||||
name: "MsHeaderOrgWs",
|
||||
name: "MsHeaderWs",
|
||||
created() {
|
||||
this.initMenuData();
|
||||
},
|
||||
|
@ -81,9 +81,9 @@ export default {
|
|||
},
|
||||
getRedirectUrl(user) {
|
||||
if (!user.lastProjectId || !user.lastWorkspaceId) {
|
||||
// 没有项目级的权限直接回到 /
|
||||
// 只是某一个工作空间的用户组也转到 /
|
||||
return "/";
|
||||
// 没有项目级的权限直接回到 /setting/project/:type
|
||||
// 只是某一个工作空间的用户组也转到 /setting/project/:type
|
||||
return "/setting/project/:type";
|
||||
}
|
||||
let redirectUrl = sessionStorage.getItem('redirectUrl');
|
||||
if (redirectUrl.startsWith("/")) {
|
|
@ -65,7 +65,7 @@ function redirectLoginPath(originPath) {
|
|||
if (hasPermissions('PROJECT_USER:READ', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_OPERATING_LOG:READ', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE:READ+FILE', 'PROJECT_CUSTOM_CODE:READ')) {
|
||||
redirectUrl = '/project/home';
|
||||
} else if (hasPermissions('WORKSPACE_SERVICE:READ', 'WORKSPACE_MESSAGE:READ', 'WORKSPACE_USER:READ', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', 'WORKSPACE_OPERATING_LOG:READ', 'WORKSPACE_TEMPLATE:READ')) {
|
||||
redirectUrl = '/setting';
|
||||
redirectUrl = '/setting/project/:type';
|
||||
} else if (hasPermissions('SYSTEM_USER:READ', 'SYSTEM_WORKSPACE:READ', 'SYSTEM_GROUP:READ', 'SYSTEM_TEST_POOL:READ', 'SYSTEM_SETTING:READ', 'SYSTEM_AUTH:READ', 'SYSTEM_QUOTA:READ', 'SYSTEM_OPERATING_LOG:READ')) {
|
||||
redirectUrl = '/setting';
|
||||
} else {
|
||||
|
|
|
@ -9,15 +9,18 @@
|
|||
<div style="position: absolute; top: 50%; left: 50%;transform: translate(-50%, -50%);">
|
||||
<div class="div-item">
|
||||
<i class="el-icon-user-solid icon-color"></i>
|
||||
{{ $t('commons.system_user')}} <span class="number"> {{statistic.userSize}} </span> {{ $t('commons.user_unit') }}
|
||||
{{ $t('commons.system_user') }} <span class="number"> {{ statistic.userSize }} </span>
|
||||
{{ $t('commons.user_unit') }}
|
||||
</div>
|
||||
<div class="div-item">
|
||||
<i class="el-icon-s-platform icon-color"></i>
|
||||
{{ $t('commons.system_workspace')}} <span class="number"> {{statistic.workspaceSize}} </span> {{ $t('commons.workspace_unit') }}
|
||||
{{ $t('commons.system_workspace') }} <span class="number"> {{ statistic.workspaceSize }} </span>
|
||||
{{ $t('commons.workspace_unit') }}
|
||||
</div>
|
||||
<div class="div-item">
|
||||
<i class="el-icon-s-cooperation icon-color"></i>
|
||||
{{ $t('commons.system_project')}} <span class="number"> {{statistic.projectSize}} </span> {{ $t('commons.workspace_unit') }}
|
||||
{{ $t('commons.system_project') }} <span class="number"> {{ statistic.projectSize }} </span>
|
||||
{{ $t('commons.workspace_unit') }}
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
@ -28,11 +31,13 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {hasPermissions} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "SettingHome",
|
||||
computed: {
|
||||
color: function () {
|
||||
return `var(--primary_color)`
|
||||
return `var(--primary_color)`;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -43,14 +48,36 @@ export default {
|
|||
projectSize: 0
|
||||
},
|
||||
result: {}
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
let projectPermissions = hasPermissions('PROJECT_USER:READ', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_OPERATING_LOG:READ',
|
||||
'PROJECT_FILE:READ+JAR', 'PROJECT_FILE:READ+FILE', 'PROJECT_CUSTOM_CODE:READ');
|
||||
|
||||
let wsPermissions = hasPermissions('WORKSPACE_SERVICE:READ', 'WORKSPACE_MESSAGE:READ', 'WORKSPACE_USER:READ',
|
||||
'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', 'WORKSPACE_OPERATING_LOG:READ',
|
||||
'WORKSPACE_TEMPLATE:READ');
|
||||
|
||||
let sysPermissions = hasPermissions('SYSTEM_USER:READ', 'SYSTEM_WORKSPACE:READ', 'SYSTEM_GROUP:READ',
|
||||
'SYSTEM_TEST_POOL:READ', 'SYSTEM_SETTING:READ', 'SYSTEM_AUTH:READ',
|
||||
'SYSTEM_QUOTA:READ', 'SYSTEM_OPERATING_LOG:READ');
|
||||
|
||||
// 只有项目权限时跳转到项目列表
|
||||
if (projectPermissions && !wsPermissions && !sysPermissions) {
|
||||
this.$router.push('/project/home');
|
||||
return;
|
||||
}
|
||||
// 只有工作空间权限时跳转到项目列表
|
||||
if (wsPermissions && !sysPermissions) {
|
||||
this.$router.push('/setting/project/:type');
|
||||
}
|
||||
},
|
||||
created() {
|
||||
mounted() {
|
||||
this.result = this.$get("/system/statistics/data", res => {
|
||||
this.statistic = res.data;
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -62,6 +89,7 @@ export default {
|
|||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.setting-card {
|
||||
height: calc(100vh - 55px);
|
||||
position: relative;
|
||||
|
@ -77,6 +105,7 @@ export default {
|
|||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.number {
|
||||
font-size: 20px;
|
||||
color: var(--primary_color);
|
||||
|
|
Loading…
Reference in New Issue