From 695773df7d55323b016d54d8b17b544ebbbac58b Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Tue, 17 Jun 2025 14:47:17 +0800 Subject: [PATCH] fix: user role (#3278) --- apps/common/auth/handle/impl/user_token.py | 4 +++- ui/src/router/chat/index.ts | 4 ++-- ui/src/router/chat/routes.ts | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/common/auth/handle/impl/user_token.py b/apps/common/auth/handle/impl/user_token.py index 87ef7eae5..b26fc4842 100644 --- a/apps/common/auth/handle/impl/user_token.py +++ b/apps/common/auth/handle/impl/user_token.py @@ -224,7 +224,9 @@ def get_role_list(user, workspace_user_role_mapping in workspace_user_role_mapping_list] + [user.role], version=version) else: - role_list = [user.role, get_role_permission(RoleConstants.WORKSPACE_MANAGE, 'default')] + role_list = [user.role] + if user.role == RoleConstants.ADMIN.value.__str__(): + role_list = [user.role, get_role_permission(RoleConstants.WORKSPACE_MANAGE, 'default')] cache.set(key, role_list, version=version) return role_list return workspace_list diff --git a/ui/src/router/chat/index.ts b/ui/src/router/chat/index.ts index e09a69e85..ea6ca141d 100644 --- a/ui/src/router/chat/index.ts +++ b/ui/src/router/chat/index.ts @@ -25,7 +25,7 @@ router.beforeEach( return } const { chatUser } = useStore() - const notAuthRouteNameList = ['user_login'] + const notAuthRouteNameList = ['login'] if (!notAuthRouteNameList.includes(to.name ? to.name.toString() : '')) { if (to.params && to.params.accessToken) { chatUser.setAccessToken(to.params.accessToken.toString()) @@ -40,7 +40,7 @@ router.beforeEach( if (authentication) { if (!token) { next({ - name: 'user_login', + name: 'login', params: { accessToken: to.params.accessToken, }, diff --git a/ui/src/router/chat/routes.ts b/ui/src/router/chat/routes.ts index 3346d49d9..5b635aa61 100644 --- a/ui/src/router/chat/routes.ts +++ b/ui/src/router/chat/routes.ts @@ -9,8 +9,8 @@ export const routes: Array = [ }, // 对话用户登录 { - path: '/user-login/:accessToken', - name: 'user_login', + path: '/login/:accessToken', + name: 'login', component: () => import('@/views/chat/user-login/index.vue'), }, // 对话用户登录