fix(用户组和权限): 修复登录后检查是否是上次登录用户

--bug=1009874 --user=刘瑞斌 [用户组和权限]-仅是工作空间成员登录系统提示error https://www.tapd.cn/55049933/s/1096141
This commit is contained in:
CaptainB 2022-01-23 10:06:35 +08:00 committed by zhangdahai112
parent 04638e2aed
commit 6232843bd1
1 changed files with 8 additions and 1 deletions

View File

@ -58,7 +58,7 @@
</template>
<script>
import {hasPermissions, publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils';
import {getCurrentUserId, hasPermissions, publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils';
import {CURRENT_LANGUAGE, DEFAULT_LANGUAGE, PRIMARY_COLOR} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
@ -82,6 +82,7 @@ export default {
openLdap: false,
authSources: [],
loginUrl: 'signin',
lastUser: null
};
},
beforeCreate() {
@ -136,6 +137,9 @@ export default {
if (license.default) {
license.default.valid(this);
}
//
this.lastUser = sessionStorage.getItem('lastUser');
},
destroyed() {
@ -218,6 +222,9 @@ export default {
};
},
checkRedirectUrl() {
if (this.lastUser === getCurrentUserId()) {
return;
}
let redirectUrl = '/';
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';