-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
The Secret Sharing UI (Phase 4, PR #202) currently has empty arrays for users and roles in the ShareDialog:
<ShareDialog
secretId={id}
users={[]} // ❌ Empty - selector shows no options
roles={[]} // ❌ Empty - selector shows no options
open={shareDialogOpen}
onClose={() => setShareDialogOpen(false)}
onSuccess={refreshShares}
/>This makes the share feature partially non-functional - users cannot select anyone to share with.
Root Cause
Frontend has no way to fetch available users/roles. Backend API endpoints missing:
GET /api/v1/users- List all users in the organizationGET /api/v1/roles- List all roles
Solution
Backend (api repo)
Create API endpoints (tracked in api#206):
GET /api/v1/users- Returns array of{id, name, email}GET /api/v1/roles- Returns array of{id, name, description}
Frontend (this repo)
-
Create API service (
src/services/userApi.ts):export async function fetchUsers(): Promise<User[]> export async function fetchRoles(): Promise<Role[]>
-
Fetch on SecretDetail mount:
const [availableUsers, setAvailableUsers] = useState<User[]>([]); const [availableRoles, setAvailableRoles] = useState<Role[]>([]); useEffect(() => { const loadShareOptions = async () => { const [users, roles] = await Promise.all([ fetchUsers(), fetchRoles() ]); setAvailableUsers(users); setAvailableRoles(roles); }; loadShareOptions(); }, []);
-
Pass to ShareDialog:
<ShareDialog users={availableUsers} roles={availableRoles} // ... />
Testing
- Unit tests for userApi.ts (mock fetch)
- Integration test: verify ShareDialog receives non-empty arrays
- E2E test: open dialog, verify users/roles appear in selector
Dependencies
- Backend: api#206 (API endpoints must be implemented first)
- Frontend: This issue (blocked until backend ready)
Priority
Medium - Feature is implemented but not fully functional. Current workaround: Users can still revoke shares and see who has access.
Related
- Implemented in: PR feat(secrets): Add Secret Sharing UI (Phase 4) #202 (Phase 4: Secret Sharing UI)
- Backend tracking: api#206
- Original spec: Phase 4: Secret Sharing UI #195 (Secret Sharing UI - Phase 4)
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
💡 Ideas