fix(rbac): polish tenant member UI; add /leave endpoint
Self-review of PR 3's TenantMembers.vue surfaced a handful of real bugs
and a few rough edges. This commit fixes them and adds the self-leave
endpoint that PR 3's design called out as a follow-up.
Frontend bug fixes
- Read err.status (not err.response.status). The axios interceptor in
utils/request.ts already flattens errors into { status, message,
... }, so the original branch-by-status code never matched and every
4xx fell through to the generic toast. Fixes 404/409 surfacing as
"userNotFound" / "alreadyMember" / "lastOwner" instead of "Something
went wrong".
- t-dialog @confirm replaces :on-confirm so the dialog stays open on
validation failure and on API error. Users can fix and retry without
retyping the email.
- Drop the t-select revert hack; with :model-value the rendered value
is already source-of-truth-on-row.role, so no setTimeout dance is
needed.
- Don't toast "no active tenant" on cold mount; watch the activeTenantId
ref and load once the auth store hydrates.
Frontend UX additions
- Empty state via t-empty (also covers the search-no-results case).
- Compact role-permissions matrix above the table, mirroring
OrganizationSettingsModal so Owners can see what each role grants
before promoting/inviting.
- Search box filtering by username/email (client-side, sufficient for
expected per-tenant member counts).
- "Leave Tenant" button — visible to any active member except the
last-Owner case (server still enforces).
Backend
- New POST /tenants/:id/leave route. Calls TenantMemberService.RemoveMember
with the caller's own user id so non-Owners can quit on their own.
Gated Viewer+ in the matrix; the existing last-Owner invariant in the
service still rejects last-Owner self-leave with 409.
- 3 new handler tests cover the happy path, the last-Owner 409 path,
and the missing-caller-id 401 path (defensive — auth middleware
always attaches a user, but the test pins the contract).
i18n
- Add tenantMember.permissions / search / leave / empty strings in all
four locales (en/zh/ko/ru).
This commit is contained in:
@@ -4369,6 +4369,18 @@ export default {
|
||||
totalCount: "총 {n}명",
|
||||
loading: "멤버를 불러오는 중…",
|
||||
retry: "다시 시도",
|
||||
empty: "아직 멤버가 없습니다. 동료를 초대해 시작하세요.",
|
||||
emptySearch: '"{q}"와 일치하는 멤버가 없습니다.',
|
||||
searchPlaceholder: "이름 또는 이메일로 검색",
|
||||
permissions: {
|
||||
title: "역할 권한",
|
||||
desc: "각 역할이 이 테넌트에서 할 수 있는 작업입니다. 서버에서 적용되며 UI 컨트롤은 표시만 합니다.",
|
||||
manageMembers: "멤버 관리",
|
||||
manageTenantConfig: "테넌트 설정 변경",
|
||||
manageInfra: "모델 / 벡터 저장소 / IM 채널 구성",
|
||||
createOwnKB: "내 지식 베이스 및 에이전트 생성/편집",
|
||||
readAll: "테넌트 콘텐츠 조회",
|
||||
},
|
||||
columns: {
|
||||
username: "이름",
|
||||
email: "이메일",
|
||||
@@ -4397,6 +4409,13 @@ export default {
|
||||
confirm: "제거",
|
||||
success: "멤버를 제거했습니다",
|
||||
},
|
||||
leave: {
|
||||
button: "테넌트 떠나기",
|
||||
confirmTitle: "이 테넌트에서 나가시겠어요?",
|
||||
confirmBody: "이 테넌트의 모든 지식 베이스와 에이전트에 접근할 수 없게 됩니다. 나중에 다시 초대받을 수 있습니다.",
|
||||
confirm: "나가기",
|
||||
success: "테넌트에서 나갔습니다",
|
||||
},
|
||||
roleChange: {
|
||||
success: "역할이 업데이트되었습니다",
|
||||
},
|
||||
@@ -4406,9 +4425,10 @@ export default {
|
||||
roleRequired: "역할을 선택하세요",
|
||||
userNotFound: "해당 이메일로 가입된 사용자가 없습니다. 먼저 가입을 요청하세요.",
|
||||
alreadyMember: "이미 이 테넌트의 멤버입니다.",
|
||||
lastOwner: "마지막 소유자를 강등하거나 제거할 수 없습니다. 다른 멤버를 먼저 소유자로 승격하세요.",
|
||||
lastOwner: "마지막 소유자를 강등, 제거, 또는 떠날 수 없습니다. 다른 멤버를 먼저 소유자로 승격하세요.",
|
||||
notFound: "멤버를 찾을 수 없습니다.",
|
||||
noTenant: "활성 테넌트가 없습니다.",
|
||||
invalidRole: "역할은 owner / admin / contributor / viewer 중 하나여야 합니다.",
|
||||
generic: "오류가 발생했습니다. 다시 시도해 주세요.",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user