Overview
Workspaces provide a multi-tenancy system that enables users to organize and manage their water quality meters, data, and team members. Each workspace can be configured as private or public, with granular role-based access control.Private Workspaces
Restricted access, visible only to the owner and invited guests
Public Workspaces
Visible to all users, accessible for viewing by anyone
Workspace Types
Workspaces can be configured as either private or public:Private Workspaces
- Accessible only to the owner and invited guests
- Default workspace type
- Guests must be explicitly added with defined roles
Public Workspaces
- Visible to all authenticated users
- Anyone can view the workspace and its data
- Useful for public monitoring stations or open data initiatives
Role-Based Access Control
The workspace system implements a comprehensive RBAC model with four primary roles:Owner
Owner
The workspace creator has full control over all aspects:
- Create, update, and delete the workspace
- Manage all meters and data
- Invite and remove guests
- Assign and modify guest roles
- Delete the workspace
Administrator
Administrator
Full management capabilities except workspace deletion:
- Manage meters and configurations
- Invite and manage guests
- Configure alerts and notifications
- View all workspace data
Manager
Manager
Day-to-day operational management:
- Create and configure alerts
- Manage meter settings
- View and analyze data
- Cannot invite new guests
Visitor
Visitor
Read-only access to workspace:
- View meters and their data
- Access analysis results
- Cannot modify any settings
- Cannot create alerts
API Endpoints
Create a Workspace
List Workspaces
Get paginated list of workspaces owned by the authenticated user:Pagination uses cursor-based navigation with
limit (1-100) and optional index parameters.Get Shared Workspaces
Retrieve workspaces where you are a guest:Get Public Workspaces
List all public workspaces (no authentication required for viewing):Guest Management
Invite a Guest
Add a user to your workspace with a specific role:When a guest is added, they automatically receive an email invitation with workspace details.
- Invitation emails sent via Resend API
- Contains workspace name, inviter information, and access link
- Templated HTML email from
HtmlTemplate.get_guest_workspace()
Update Guest Role
Remove a Guest
List Workspace Guests
Workspace Validation
Workspaces enforce validation rules:- Minimum length: 3 characters
- Maximum length: 50 characters
- Whitespace is trimmed before validation
Update a Workspace
Delete a Workspace
Implementation Details
Repository Pattern
Workspaces use the repository pattern for data access:- WorkspaceRepository: Core workspace CRUD operations (source:~/workspace/source/app/features/workspaces/domain/repository.py)
- WorkspaceGuestRepository: Guest management operations (source:~/workspace/source/app/features/workspaces/domain/workspace_share_repo.py)
Authorization Service
The workspace authorization service provides access control:~/workspace/source/app/features/workspaces/domain/services.py:1
Best Practices
Organize by Purpose
Create separate workspaces for different monitoring projects or locations
Assign Minimal Roles
Grant the minimum necessary permissions to guests
Use Public Wisely
Only make workspaces public if data should be openly accessible
Regular Audits
Periodically review guest lists and remove inactive users