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 0c248627ba
commit 15dfa118ed
1 changed files with 8 additions and 1 deletions

View File

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