Overview
Beils Dashboard implements a role-based access control (RBAC) system to secure features and data based on user roles. This ensures that users only have access to the features they need for their job responsibilities.Role Structure
The system uses a simple two-tier role hierarchy defined in the Prisma schema:Administrator (ADMIN)
The ADMIN role has unrestricted access to all system features and data.Permissions
User Management
User Management
- Create new user accounts
- Edit any user account
- Delete user accounts
- Toggle user status (activate/deactivate)
- View all users in the system
- Assign roles to users
Client Management
Client Management
- View all clients
- Create and edit client records
- Delete clients
- Access client consents and questionnaires
- Manage client revocations
Catalog Management
Catalog Management
- Manage products, services, and packs
- Create and edit categories, subcategories, and brands
- Manage tags for products
- Update pricing and tax rates
- Control inventory levels
Sales & Point of Sale
Sales & Point of Sale
- Process all sales transactions
- Manage shopping carts
- Handle payments and refunds
- Override prices if needed
- View all transaction history
Marketing
Marketing
- Create and manage coupons
- Configure bonus programs
- Issue and manage gift cards
- View marketing performance metrics
Financial Management
Financial Management
- View all financial data
- Manage client debts
- Generate financial reports
- Access payment history
Appointments
Appointments
- View all bookings across all staff
- Create appointments for any client
- Assign appointments to staff members
- Cancel or reschedule any booking
Reports & Analytics
Reports & Analytics
- Access all reports and dashboards
- View sales analytics
- Generate custom reports
- Export data for analysis
System Configuration
System Configuration
- Configure system settings
- Manage business hours and preferences
- Configure tax rates
- Set up payment methods
- Access audit logs
Use Cases
Business Owner
Full oversight of business operations, financial data, and strategic decisions
Manager
Supervise staff, manage inventory, handle administrative tasks
Standard User (USER)
The USER role is designed for staff members who need access to daily operational features without administrative capabilities.Permissions
Client Management
Client Management
✅ View all clients
✅ Create new client records
✅ Edit client information
❌ Delete clients
✅ Manage client consents and questionnaires
Catalog Management
Catalog Management
✅ View products, services, and packs
✅ Search and filter catalog items
❌ Create or edit products (typically restricted)
❌ Delete catalog items
❌ Modify pricing or tax rates
Sales & Point of Sale
Sales & Point of Sale
✅ Process sales transactions
✅ Manage shopping carts
✅ Accept payments
✅ View own transaction history
❌ Override prices
❌ Issue refunds without approval
Marketing
Marketing
✅ Apply coupons to transactions
✅ Use gift cards for payments
✅ View active promotions
❌ Create or modify marketing campaigns
Appointments
Appointments
✅ View all bookings
✅ Create appointments
✅ Manage own assigned appointments
✅ Update appointment status
❌ Cancel appointments assigned to other staff
Reports
Reports
✅ View basic dashboards
✅ Access personal performance metrics
❌ View financial reports
❌ Export sensitive data
Administration
Administration
❌ No access to user management
❌ Cannot modify system settings
❌ Cannot access audit logs
❌ Cannot manage other users
Use Cases
Beautician
Book and manage client appointments, update client records
Receptionist
Handle check-ins, process sales, manage the schedule
Sales Staff
Process transactions, apply promotions, manage inventory
Permission Enforcement
Beils Dashboard enforces role-based permissions at multiple levels:Server-Side Middleware
The authentication middleware (server/middleware/auth.ts) validates all API requests:
API Endpoints
While the middleware validates authentication, role-specific authorization should be implemented at the endpoint level:Currently, most endpoints do not enforce role-level authorization beyond authentication. You may need to implement additional role checks for sensitive operations.
Client-Side Guards
The frontend uses Vue Router navigation guards and Pinia stores to control UI access:Assigning Roles
Roles are assigned during user creation or can be updated later:During User Creation
- Open the Create User form
- Select role from dropdown (defaults to USER)
- Save the new user
Updating Existing User Role
- Navigate to Users management
- Click Edit on the user account
- Change the Role field to ADMIN or USER
- Click Update
Role changes take effect immediately. The user will have new permissions on their next action or page refresh.
Default Role
When creating users via API without specifying a role:JWT Token Structure
Authentication tokens contain the user’s role:Implementing Custom Permissions
If you need more granular permissions beyond ADMIN/USER:Option 1: Extend Role Enum
Add new roles to the Prisma schema:prisma migrate to update the database.
Option 2: Permission Flags
Add boolean flags to the User model:Option 3: Separate Permissions Table
Create a many-to-many relationship:Security Best Practices
Principle of Least Privilege
Grant users only the minimum permissions needed for their role
Regular Audits
Review user roles quarterly and adjust as job responsibilities change
Separation of Duties
Avoid giving multiple ADMIN accounts when possible
Access Logging
Monitor ADMIN actions for security and compliance
Common Scenarios
Promoting a User to Admin
- Verify the user needs full system access
- Edit their user account
- Change role from USER to ADMIN
- Notify the user of their new permissions
Temporarily Restricting Access
Instead of changing roles, toggle the user’s status:- Locate user in user management
- Click Toggle Status to set status to OFF
- User cannot log in while status is OFF
- Re-enable when access should be restored
Handling User Transitions
When staff members change positions:- Review their new job responsibilities
- Adjust their role accordingly (ADMIN ↔ USER)
- If leaving the company, set status to OFF rather than deleting
- This preserves historical data integrity
Related Resources
User Management
Create and manage user accounts
Configuration
Configure authentication settings
Authentication API
API documentation for login and tokens
Data Management
Export and backup user data