👤 User Blocks
User blocks provide comprehensive functionality for user management in Nodeblocks applications. These blocks handle user lifecycle operations including creation, authentication, profile management, and account administration.
🎯 Overview
User blocks are designed to:
- Manage user accounts with full CRUD operations
- Handle authentication and authorization flows
- Provide profile management with validation
- Support account security with lock/unlock operations
- Enable user administration with role-based access
📦 Block Types
🔍 Schemas
JSON Schema definitions for user data validation:
- userSchema: Base user entity structure
- createUserSchema: User registration validation
- updateUserSchema: Profile update validation
- getUserSchema: User retrieval validation
- deleteUserSchema: User deletion validation
- lockUserSchema: User account lock validation
- unlockUserSchema: User account unlock validation
- findUsersSchema: User search with filtering and pagination
🔧 Blocks
Pure business logic functions for user profile operations:
- getUserById: Profile retrieval from datastore
- normalizeUser: Normalize single user object
- normalizeUsers: Normalize array of user objects
⚙️ Handlers
Core business logic for user operations:
- createUser: User account creation
- getUserById: User data retrieval
- updateUser: Profile updates
- deleteUser: Account deletion
- lockUser: Account security locking
- unlockUser: Account unlocking
🛣️ Routes
HTTP endpoint definitions for user operations:
- createUserRoute: POST
/users
with user creation handler - getUserRoute: GET
/users/:profileId
with user retrieval handler - findUsersRoute: GET
/users
with user search and pagination - updateUserRoute: PATCH
/users/:profileId
with user update handler - deleteUserRoute: DELETE
/users/:profileId
with user deletion handler - lockUserRoute: POST
/identities/:identityId/lock
with user locking handler - unlockUserRoute: POST
/identities/:identityId/unlock
with user unlocking handler - getAvatarUploadUrlRoute: GET
/user-profiles/:profileId/avatar-upload-url
with signed URL generation
🚀 Features
Complete user management features combining schemas, routes, and handlers:
- createUserFeature: User registration with validation
- getUserFeatures: User profile retrieval with access control
- findUsersFeatures: User search and listing with pagination
- editUserFeatures: User profile updates with authorization
- deleteUserFeatures: User account deletion with access control
- lockUserFeatures: User account locking (admin only)
- unlockUserFeatures: User account unlocking (admin only)
- getAvatarUploadUrlFeature: Avatar upload URL generation
✅ Validators
Validation functions for user operations:
- ownsProfile: Validates profile ownership by the authenticated identity
- validateUserProfileAccess (deprecated): Legacy access validator; replaced by
ownsProfile
🔗 Related Documentation
- User Schema Blocks - User data validation and contracts
- User Handler Blocks - User business logic functions
- User Route Blocks - HTTP endpoint definitions
- User Feature Blocks - Complete user management features
- User Validator Blocks - User validation functions