Overview
Genie Helper synchronizes user roles and permissions between Directus CMS and AnythingLLM to maintain consistent access control across the platform. Admin users can also impersonate other users for support and debugging purposes.RBAC Synchronization
User roles and permissions are automatically synchronized between Directus and AnythingLLM through the RBAC sync system.How It Works
- Webhook-based sync: Directus triggers the sync endpoint when user roles change
- Bidirectional updates: Changes in either system propagate to the other
- Secure communication: Protected by
RBAC_SYNC_WEBHOOK_SECRETenvironment variable - Implementation:
server/endpoints/api/rbacSync.js
Environment Configuration
Ensure these environment variables are set:Supported Roles
User Registration
Genie Helper uses an invite-gated registration system to control platform access during the alpha phase.Registration Flow
- Invite code validation: User enters alpha invite code
- Code verification: Validated against AnythingLLM invite API
- Account creation: Creates user in both Directus and AnythingLLM
- Persona setup: Initializes
user_personascollection with defaultonboarding_state - JWT issuance: Returns authentication token for immediate access
Implementation Details
- Endpoint:
/api/register - Source:
server/endpoints/api/register.js - Frontend:
dashboard/src/pages/Register/index.jsx - Admin token: Registration uses admin token for user creation proxy
Default User Configuration
User Impersonation
Admins can impersonate other users to debug issues, provide support, or test features from a user’s perspective.How to Impersonate
- Access admin panel: Navigate to
geniehelper.com/admin - Select user: Find the user you want to impersonate
- Impersonate: Click “View As” from the admin interface
- Session swap: System creates temporary impersonation session
- Exit impersonation: Close the impersonation tab or explicitly log out
Security Features
- Admin-only: Only users with admin role can impersonate
- Session isolation: Uses
sessionStoragefor impersonation tabs (notlocalStorage) - Audit logging: All impersonation events are logged
- Route protection:
/view-asroute requires admin authentication
Implementation
- Backend:
server/endpoints/api/impersonate.js - Frontend: Admin panel interface
- Auth handling: Separate JWT token issued for impersonation session
Impersonation Use Cases
- Debug user-specific issues
- Test pricing tier limitations
- Verify platform connection status
- Review user’s media library
- Check AI chat history and context
User Profile Management
User profiles are managed through theuser_personas collection in Directus.
Key Fields
Onboarding States
- EXTENSION_INSTALL: User needs to install browser extension
- DATA_COLLECTION: Collecting platform data via scrape
- PROCESSING: Building taxonomy and persona nodes
- COMPLETE: Onboarding finished, full access granted
Admin Credentials
API Key
Related Collections
directus_users: Core user accountsuser_personas: Extended user profiles and preferencesagent_audits: Logs of all agent actions per userhitl_sessions: Human-in-the-loop login requestsplatform_sessions: User platform connections and cookies
