Overview
CONFOR implements a multi-tenant architecture where all forestry data is scoped to Organizations. Each organization represents a distinct entity (company, government agency, or institution) managing their own forest patrimony, with complete data isolation and customizable settings.Key Capabilities
Data Isolation
Complete data segregation between organizations for security and compliance
Custom Branding
Organization-specific logos and visual identity
Geographic Association
Link organizations to countries for regional compliance
Flexible Settings
JSON-based configuration for organization-specific parameters
Data Model
Organization Schema
prisma/schema.prisma
Settings Structure
Thesettings field is a flexible JSON object that can store:
- RIF/Tax ID: Organization tax identification
- Custom parameters: Industry-specific configurations
- Regional settings: Locale and timezone preferences
src/app/api/organizations/route.ts
Creating Organizations
User Workflow
Access Organization Management
Navigate to Admin → Organizations (requires ADMIN or SUPER_ADMIN role)
Create New Organization
Click “New Organization” and fill in required details:
- Organization name
- RIF/Tax ID
- Country association (optional)
API Endpoint
POST/api/organizations
src/validations/organization.schema.ts
Example Request
Only SUPER_ADMIN users can create new organizations. ADMIN users can only view and edit their own organization.
Permission Scoping
Role-Based Access
CONFOR implements strict role-based access control:src/app/api/organizations/route.ts
Access Matrix
| Action | SUPER_ADMIN | ADMIN | USER |
|---|---|---|---|
| Create Organization | ✅ | ❌ | ❌ |
| View All Organizations | ✅ | ❌ | ❌ |
| View Own Organization | ✅ | ✅ | ✅ |
| Edit Own Organization | ✅ | ✅ | ❌ |
| Delete Organization | ✅ | ❌ | ❌ |
| Manage Users | ✅ | ✅ (own org) | ❌ |
Organization Hierarchy
Each organization can manage:- Users & Roles
- Forest Data
- Catalogs
- System Settings
- User accounts scoped to the organization
- Custom roles with granular permissions
- Role assignments and access control
Data Isolation
All queries automatically filter by organization:src/app/api/forest/patrimony/route.ts
Cascading Filters
For nested resources, organization filters cascade down:src/app/api/forest/patrimony/route.ts
Organization Settings
Active Status
Organizations can be activated or deactivated:prisma/schema.prisma
- Users cannot log in
- API requests return authorization errors
- Data remains intact for potential reactivation
Soft Delete
Organizations are soft-deleted (never permanently removed):Branding & Customization
Organization Logo
POST/api/organizations/logo
Upload organization logos for custom branding:
- Supported formats: PNG, JPG, SVG
- Recommended size: 200x200px
- Stored in
logoUrlfield
Country Association
Organizations can be linked to countries:prisma/schema.prisma
- Regional compliance settings
- Localized land use types
- Geographic reporting
Managing Organizations
Listing Organizations
GET/api/organizations
Returns paginated list of organizations:
Updating Organizations
PATCH/api/organizations/[id]
Update organization details:
Restoring Organizations
POST/api/organizations/[id]/restore
Restore a soft-deleted organization:
Import/Export
Bulk Import
POST/api/organizations/import
Import multiple organizations from CSV/Excel:
Required columns:
name: Organization namerif: Tax identification numbercountryId: UUID of associated country (optional)
Bulk Export
GET/api/organizations/export
Export all organizations to CSV/Excel format.
System Configuration
Organizations can have custom system configurations:prisma/schema.prisma
Configuration Categories
- Accounting: Currency, valuation methods
- Geospatial: Coordinate systems, precision settings
- Reporting: Date formats, language preferences
- Security: Session timeout, password policies
Default Organization
During user registration, a default organization is created:src/app/api/auth/register/route.ts
Best Practices
Plan Organization Structure
Define your organization hierarchy before importing data. Consider subsidiaries, departments, or regional offices.
Configure Settings Early
Set up tax IDs, country associations, and custom parameters before users begin data entry.
Related Documentation
- Authentication - User authentication and access control
- Forest Patrimony - Managing forest hierarchy within organizations
- API Reference - Organization API endpoints