services/permissions.py:38-87.
Understanding the Matrix
Each entry in the matrix maps a resource and action combination to a policy for each role:Policy Values
The system uses four distinct policy values:allow
Full AccessUser can perform this action without any restrictions or additional approval.
own
Ownership RequiredUser can only perform this action on resources they own. Requires
artist_id matching.locked
Master Code RequiredAssistant can perform this action only after entering master code for temporary elevation.
deny
No AccessUser cannot perform this action under any circumstances.
Complete Permission Matrix
Agenda (Schedule)
Appointments, schedule blocks, and calendar operations.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
view | allow | allow | allow | Everyone can view full schedule |
create | allow | allow | own | Artists can only book own appointments |
edit | allow | allow | own | Artists can only modify own appointments |
cancel | allow | allow | own | Artists can only cancel own appointments |
complete | allow | allow | own | Artists can only complete own appointments |
no_show | allow | allow | own | Artists can only mark own no-shows |
block | allow | allow | own | Artists can only block own time |
export | allow | allow | own | Artists can only export own schedule |
services/permissions.py:40-47.
Key insights:
- Everyone has read access to the full studio schedule
- Admin and assistant can manage all appointments (front desk operations)
- Artists are restricted to their own appointments via “own” policy
- No actions require master code elevation (daily operations)
Clients
Client database, contact information, notes, and consent forms.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
view | allow | allow | allow | Everyone can view all clients |
create | allow | allow | allow | Everyone can add new clients |
edit | allow | locked | deny | Assistant needs master code to edit |
delete | allow | locked | deny | Assistant needs master code to delete |
consent | allow | allow | own | Artists can manage consent for own appointments |
notes | allow | allow | own | Artists can edit notes for own appointments |
export | allow | locked | deny | Assistant needs master code to export |
services/permissions.py:50-56.
Key insights:
- Client viewing and creation is open to all (intake process)
- Editing and deletion are protected (data integrity)
- Artists can add notes only to their own appointments
- Export is protected (privacy concerns)
Staff
User accounts, artist profiles, and staff management.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
view | allow | allow | allow | Everyone can view staff directory |
manage_users | allow | deny | deny | Only admin can create/modify users |
toggle_active | allow | deny | deny | Only admin can enable/disable accounts |
services/permissions.py:59-61.
Key insights:
- Staff directory is visible to all
- User management is exclusively admin (security)
- No master code elevation available (admin only)
Portfolio
Artist portfolios and image galleries.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
view | allow | allow | allow | Everyone can view all portfolios |
edit | allow | deny | own | Artists can only edit own portfolio |
upload | allow | deny | own | Artists can only upload to own portfolio |
services/permissions.py:62-64.
Key insights:
- Portfolios are publicly viewable (for client selection)
- Artists have full control over their own portfolio
- Assistants cannot modify portfolios (artist autonomy)
- Admin can manage all portfolios (quality control)
Reports
Financial reports, transactions, refunds, and cash management.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
view | allow | allow | own | Artists can only view own reports |
export | allow | locked | deny | Assistant needs master code to export |
view_tx | allow | allow | own | Artists can only view own transactions |
refund_void | allow | locked | deny | Assistant needs master code for refunds |
cash_close | allow | locked | deny | Assistant needs master code to close drawer |
services/permissions.py:67-71.
Key insights:
- Artists can only see their own financial data (privacy)
- Admin has unrestricted financial access
- Sensitive financial operations require master code for assistants
- Artists cannot process refunds (escalate to front desk)
Inventory
Stock management, supplies, and inventory operations.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
view | allow | allow | allow | Everyone can view inventory levels |
create_item | allow | locked | deny | Assistant needs master code to add items |
edit_item | allow | locked | deny | Assistant needs master code to edit items |
stock_in | allow | locked | deny | Assistant needs master code for deliveries |
stock_adj | allow | locked | deny | Assistant needs master code for adjustments |
cycle_count | allow | locked | deny | Assistant needs master code for physical counts |
export | allow | locked | deny | Assistant needs master code to export |
services/permissions.py:74-80.
Key insights:
- Inventory visibility is open to all (check stock)
- All modifications require elevation or admin (financial impact)
- Artists cannot adjust inventory (request from front desk)
- Inventory is financially sensitive (locked actions)
Security
System settings, audit logs, backups, and master code management.| Action | Admin | Assistant | Artist | Notes |
|---|---|---|---|---|
settings | allow | deny | deny | Only admin can access system settings |
audit | allow | deny | deny | Only admin can view audit logs |
backup | allow | deny | deny | Only admin can manage backups |
rotate_code | allow | deny | deny | Only admin can change master code |
services/permissions.py:83-86.
Key insights:
- All security features are admin-exclusive
- No master code elevation available (admin only)
- Strict separation of security duties
- Critical for audit trail and compliance
Permission Checking
The permission system is implemented through thecan() function:
services/permissions.py:115-145.
Usage Examples
- Simple Check
- Ownership Check
- Elevation Check
allow or deny policy, only role matters.Enforcement
Permissions should be enforced at multiple layers:1. UI Layer
Hide or disable controls based on permissions:2. Service Layer
Useenforce() before database writes:
services/permissions.py:167-189.
3. API Layer
Validate permissions on every request:Defense in Depth: Always enforce permissions at service layer even if UI already checks. UI can be bypassed via API.
Master Code Elevation
What Actions Are Locked?
Use this helper to determine if an action requires master code:services/permissions.py:102-103.
Complete List of Locked Actions
These actions require assistants to enter the master code: Clients:edit- Edit client contact informationdelete- Delete client recordsexport- Export client data
export- Export financial datarefund_void- Process refunds and voidscash_close- Close cash drawer
create_item- Add new inventory itemsedit_item- Edit item detailsstock_in- Receive stock deliveriesstock_adj- Adjust stock quantitiescycle_count- Perform physical countsexport- Export inventory data
Elevation Workflow
services/permissions.py:152-159 and services/permissions.py:111-112.
Elevation Timeout
Elevation is time-limited and stored in memory:services/permissions.py:91-108.
Default Deny Policy
If a resource/action combination is not defined in the matrix, it defaults todeny:
services/permissions.py:94-99.
This ensures new features are secure by default.
Permission Patterns
Pattern 1: Full Admin Access
Admins haveallow for almost everything:
Pattern 2: Assistant with Elevation
Common operations areallow, sensitive ones are locked:
Pattern 3: Artist Ownership
Artists can manage their own resources:Pattern 4: Admin-Only Security
Security features are exclusively admin:Adding New Permissions
When adding new features, update the RBAC matrix:- Start restrictive: Default to
denyorlocked, then open up if needed - Consider workflow: What does each role need for their job?
- Financial impact: Lock actions that affect money or costs
- Data integrity: Lock or deny actions that could corrupt data
- Privacy: Use
ownpolicy to protect individual artist data - Admin override: Admin should have
allowfor audit/support purposes
Testing Permissions
Test each role’s access systematically:Quick Reference
By Role
Admin
Admin
Can do everything:
- All agenda operations for all artists
- All client operations including edit/delete
- User management (create, modify, deactivate)
- All financial operations without approval
- All inventory operations
- All security settings
- Rotate master code
Assistant
Assistant
Can do without master code:
- All agenda operations for all artists
- View and create clients
- View all reports and transactions
- View all inventory
- View staff directory and portfolios
- Edit and delete clients
- Export client data
- Process refunds and voids
- Close cash drawer
- Export financial reports
- All inventory modifications
- User management
- Edit portfolios
- Access security settings
Artist
Artist
Can do for own resources:
- Manage own appointments
- Block own time off
- Edit portfolio
- View own reports
- Add notes to own appointments
- View all schedules
- View all clients
- Create new clients
- View inventory
- View staff directory
- Modify other artists’ data
- Edit client information
- Process refunds
- Modify inventory
- Access security settings
By Resource
Agenda
Agenda
- Admin/Assistant: Full control over all appointments
- Artist: View all, modify own only
- No locked actions (daily operations)
Clients
Clients
- Admin: Unrestricted access
- Assistant: View/create allowed, edit/delete locked
- Artist: View/create allowed, modifications denied
Staff/Portfolio
Staff/Portfolio
- Admin: Full control
- Assistant: View only
- Artist: View all, edit own portfolio
Reports
Reports
- Admin: Full access to all financial data
- Assistant: View all, sensitive operations locked
- Artist: View own only, cannot export or refund
Inventory
Inventory
- Admin: Full control
- Assistant: View allowed, modifications locked
- Artist: View only
Security
Security
- Admin: Exclusive access
- Assistant/Artist: All denied
Related Resources
Roles Overview
Learn about the three-role system
Admin Role
Admin capabilities and responsibilities
Assistant Role
Assistant permissions and master code
Artist Role
Artist limitations and “own” policies
Security Settings
Configure master code and audit logs
API Reference
Permission functions API documentation