I wan't to build one big multi page app with different users Hierarchy and organization something like:
Internal user:
- Admin - can see all , can create new users and new organization
- Organizations CSM can see all data of each organization assigned to him, and can invite (create new users for each organization. have a all organizations report screen access
- Organization 1# User under this one can see data and screens related to this Organization only
- The organization manager can see all data and screens open to this organization. Can manage the user under him
- Analyst - can see specific data under the organization
Any idea how I can implement that scalability and simple to use?
Hello @R_S_I_F ,
To build a scalable, multi-user, multi-organization app in Retool with different user hierarchies, here's a summarized approach:
- Database Setup
- Users Table: Store user roles (Admin, CSM, Organization Manager, Analyst, etc.).
- Organizations Table: Store organization details.
- Organization Users Table: Map users to specific organizations and roles.
- User Roles and Permissions
- Admin: Can see all users and organizations, and create new ones.
- CSM: Can manage and view organizations assigned to them.
- Organization Manager: Manages data and users within their assigned organization.
- Analyst: Sees specific data under the organization they belong to
- Conditional Visibility
- Use
{{ currentUser.role }}
to show/hide UI elements based on user roles.
- For organization-specific data, use
{{ currentUser.organization_id }}
.
- Dynamic Queries
- Admins fetch all data:
SELECT * FROM organizations
.
- CSMs fetch assigned organizations:
SELECT * FROM organizations WHERE csm_id = {{ currentUser.id }}
.
- Organization Managers fetch data for their org:
SELECT * FROM data WHERE organization_id = {{ currentUser.organization_id }}
.
- Analysts see specific data within their organization.
- User Management
- CSM/Manager can invite new users, assign them roles, and link them to organizations using forms and queries.