Invite and manage members with Roles
This guide will help you manage organizations by inviting members and assigning roles in the Next.js Supabase AI template for efficient user collaboration.
Overview
In the Next.js Supabase AI Template, organizations play a crucial role in managing user access and collaboration. This guide provides a comprehensive overview of how to manage organizations, invite members, and assign roles within the template.
Key Features of Organization Management
- Built-in Support for Organizations: The template supports groups of users, referred to as organizations, allowing for organized collaboration and management.
- Role-Based Access Control (RBAC): Users can be assigned different roles, which determine their access to features within the template.
Inviting New Members
Users can invite new members to join an organization. The invitation process is straightforward, with predefined roles, and the option to customize additional roles as needed.
Steps to Invite Members
- Access the Organization Management Interface: Navigate to the Members tab within the template.
- Click on 'Invite Member': Initiates the invitation process.
- Enter User Details:
- Email Address: Enter a valid email address for the invitation.
- Assign a Role: Select a predefined role for the new member:
- Member: Standard access to organization features.
- Admin: Elevated access to manage organization settings and users.
- Send Invitation: Click the 'Invite Member' button to complete the process. An invitation link will be sent to the provided email address, allowing the invited user to sign up and join the organization using that link.
Invited User Details
Once an invitation is sent, the inviting user can view the following details about the invited member:
- User Name: The name of the invited member.
- Email Address: The email associated with the invited member.
- Role: The assigned role (Member or Admin).
- Status: Indicates whether the invitation is joined, or pending.
- Created On: The date the invitation was sent.
- Action: Only the Organization Owner, Organization Admin, and Super Admin can see the delete action in the members' table.
Deleting Members
Organization Owners, Admins, and Super Admins have the ability to delete members within the organization. This can be done directly from the members' table, where they will see an option to remove members as necessary.
Role-Based Feature Access (RBAC)
Feature access is determined by user roles, ensuring proper permissions within the organization.
-
Super Admin Has full visibility across the application but cannot update others' emails, enable 2FA for other users, update passwords, or modify other organizations’ billing.
-
Owner Has full access to their own organization, including managing billing.
-
Admin Has full access to their own organization except for billing and cannot delete the organization.
-
Member Has full access except for billing but cannot invite or remove users, update or delete the organization name and logo, or delete the organization.
Customizing the Invite Member Section
You can customize the invite member modal to add extra fields To do this:
- Update the
invite-member-form.tsx
to add your new field. - Decide if the field is required or optional by adjusting the form validation.
- Update the backend and
organization_memberships
table to handle and store the new data.
This lets you collect any additional details you need during the invite process.