feat(rbac-ui): rework tenant identity surfaces
Polish the role-aware UI surfaces wired up in #1303 so role / tenant context is discoverable from the main shell rather than buried in a hover-only switcher or the settings drawer. UserMenu sidebar trigger: - Replace username + email with `tenant name / username · role-icon role-name` so the active tenant + current role are always visible at the bottom of the sidebar; long usernames elide before the role label. - Single-tenant users keep the old username + email layout. UserMenu dropdown: - Promote the tenant switcher to a clickable header row at the top of the dropdown (tenant name + swap icon, role caption underneath). - Drop the standalone "Switch tenant" submenu entry — the header row hosts the same hover panel. - Switcher panel rows now lead the role label with a role icon (owner / admin / contributor / viewer) and surface the home tenant via a small home dot on the avatar instead of a separate badge, so the right-edge "current" badge column lines up across rows. Settings: - Add SECTION_MIN_ROLE so settings nav entries are gated by the same role matrix the backend enforces (chathistory + ollama + websearch + vectorstore + parser + storage + mcp → admin; api → owner; rest → viewer). UserMenu quickNav uses the same map. - Render a role-denied empty state when a user deep-links into a section their role can't reach. - Split account info (id / username / email / created_at) out of the owner-only API Info page into a new viewer-accessible UserProfile section. Composable: - New useRoleLabel composable centralises role → label and role → icon mapping (consumed by UserMenu trigger / dropdown / switcher panel). - useHomeTenant derives the home tenant id from `user.tenant_id` (the immutable signup-time field), not `tenant.id` which now reflects the active tenant after a switch. Lists: - KnowledgeBaseList / AgentList default the sidebar selection to "all" for viewers (who typically own nothing) so the empty "Mine" state no longer hides the shared content they actually have access to; contributor+ keeps "Mine" as the default. i18n: - Tenant role labels: 拥有者/贡献者/查看者 → 所有者/编辑/访客 (all four locales updated, plus new userProfile / roleDenied / homeBadge keys). The org-vs-tenant scope question raised during review is intentionally out of scope here — that needs an RFC before any UI/backend changes.
This commit is contained in:
@@ -627,6 +627,10 @@ export default {
|
||||
workspace: 'Пространство и доступ',
|
||||
system: 'Сведения о системе',
|
||||
},
|
||||
roleDenied: {
|
||||
title: 'Недостаточно прав',
|
||||
desc: 'Ваша роль не позволяет открыть этот раздел настроек. Обратитесь к администратору арендатора, чтобы запросить нужную роль.',
|
||||
},
|
||||
weknoraCloud: {
|
||||
title: 'WeKnora Cloud',
|
||||
description: 'Настройте учётные данные APPID и APPSECRET для WeKnora Cloud. Данные используются для модельных сервисов и движка парсинга документов.',
|
||||
@@ -1354,8 +1358,13 @@ export default {
|
||||
switcher: {
|
||||
menuLabel: 'Сменить арендатора',
|
||||
currentBadge: 'Текущий',
|
||||
homeBadge: 'Home',
|
||||
homeTooltip: 'Ваш основной арендатор',
|
||||
empty: 'Вы состоите только в одном арендаторе',
|
||||
},
|
||||
currentChip: {
|
||||
home: 'Основной арендатор',
|
||||
},
|
||||
sectionDescription: 'Просмотр детальной конфигурации арендатора',
|
||||
apiDocument: 'Документация API',
|
||||
name: 'Имя арендатора',
|
||||
@@ -4275,6 +4284,10 @@ export default {
|
||||
confirmRemoveBody:
|
||||
'Сохранённые учётные данные будут безвозвратно удалены. Интеграции, использующие их, перестанут работать до настройки нового значения.',
|
||||
},
|
||||
userProfile: {
|
||||
title: 'Информация о пользователе',
|
||||
description: 'Просмотр базовых данных аккаунта (ID пользователя, имя, email, дата регистрации).',
|
||||
},
|
||||
tenantMember: {
|
||||
title: 'Участники',
|
||||
sectionDescription: 'Приглашайте коллег в тенант и управляйте их ролями. Добавлять и удалять участников может только Владелец.',
|
||||
|
||||
Reference in New Issue
Block a user