Technology
The user module provides user management functionality for Project Forge applications. It handles user authentication, profiles, session management, and provides both filesystem-based and database-backed user storage options.
Overview
This module provides:
- User Profile Management: User account creation, updates, and profile handling
- Session Integration: Seamless integration with Project Forge’s session system
- Flexible Storage: Support for both filesystem-based and database-backed user storage
- Authentication Support: Works with OAuth and other authentication modules
- Customizable Models: Easily customizable user models through export definitions
Key Features
User Management
- User profile creation and management
- Automatic user session integration
- Profile persistence across sessions
- User data validation and sanitization
Storage Options
- Filesystem: Default implementation using filesystem storage
- Database: Full database integration with customizable schema
- Hybrid: Combine both approaches as needed
Integration
- Works seamlessly with
oauthmodule for authentication - Integrates with
databasemodule for persistent storage - Compatible with
auditmodule for user activity tracking - Supports role-based access control when combined with RBAC modules
Package Structure
Core Components
user/- User model definitions and core logic- User struct definitions
- Profile management utilities
- Session integration handlers
controller/- HTTP handlers for user operations- Profile viewing and editing
- User registration and onboarding
- Session management endpoints
service/- User business logic and operations- User creation and updates
- Profile validation
- User lookup and search functionality
Storage Implementations
Filesystem Storage: Default implementation for simple deployments
- JSON-based user profiles
- File-based session persistence
- No external dependencies
Database Storage: Full database integration (requires
databasemodule)- Customizable user schema
- SQL-based queries and operations
- Transaction support
Configuration
Default User Model
The module provides a basic user model with required fields:
1 | |
Custom User Models
For database-backed users, create an export model at ./.projectforge/export/models/user.json:
1 | |
Required Fields: id and name are required for all user models.
Dependencies
Required Modules
core- Base infrastructure and utilities
Optional Modules
database- For database-backed user storageexport- For custom user model generationoauth- For authentication integrationaudit- For user activity tracking
Usage Examples
Basic User Operations
1 | |
Session Integration
1 | |
Source Code
- Repository: https://github.com/kyleu/projectforge/tree/main/module/user
- License: CC0 (Public Domain)
- Author: Kyle U (kyle@kyleu.com)
See Also
- OAuth Module - Authentication integration
- Database Module - Database storage backend
- Export Module - Custom model generation
- Audit Module - User activity tracking
- Project Forge Documentation - Complete documentation