Granting Admin Access in Firebase Firestore
Create Your First User
Now that the necessary environment variables are set and the SaaSavant dependencies are installed, you can create your first user. This can either be a temporary test user or a real user that you can set as an Admin. Setting a user as Admin will allow you to access the SaaSavant Admin dashboard and manage your SaaS product as mentioned earlier.
Once this is done the first time and you have access to the Admin Dashboard, you can grant or remove Admin access for any user. The following setup process is only required to grant Admin access to the first Admin user.
- Open a terminal and navigate to your project directory.
cd /path/to/your/project
- Run the following command:
npm run dev
-
Open your browser and navigate to the
Signup
page or click here: Signup (opens in a new tab) -
Enter your credentials (email and password) then submit the form.
Check your email for a welcome email. (This may take a few minutes and we don't need it for setup, but it's good to check and make sure the sign up flow is working properly. If you have set up the project correctly, you should receive an email shortly.)
To grant admin access, follow these steps:
-
Navigate to the Firebase Console:
- Open your web browser and go to the Firebase Console (opens in a new tab).
- Select your project from the list.
-
Access the Firestore Dashboard:
- In the left-hand menu, click on Firestore Database.
-
Locate the Users Collection:
- In the Firestore Database pane, find and click on the Users collection to expand it.
-
Find the User Document:
- Look for the user document you recently created, it should be theonly one in the collection. Click on the document to open it.
-
Change
isAdmin
Field:
- By default, all users are set to
false
. To grant admin access, set theisAdmin
field totrue
.
-
Save and Confirm Changes:
- Ensure that the
isAdmin
field is set totrue
. - Click the
Save
button.
- Ensure that the
Note: You can set as many users as you want to be Admins. However, be cautious when assigning Admin rights, as granting these privileges to the wrong person can have significant security implications.
The Admin Dashboard in SaaSavant provides a comprehensive interface for managing your application.
Key features include:
Paginated User List
- User Management: View and manage all registered users.
- Pagination: Display users in pages, with a default limit set to 50 users per page and scrolling enabled after the first 10 for ease of navigation.
Announcements
- Create Announcements: Admins can create and publish announcements to be displayed to all users.
Support Tickets
- Support Tickets: Admins can manage support tickets and mark them open or resolved. Users can submit support tickets from their dashboard.
- Pagination: Display support tickets in pages, for ease of navigation.