Spaces:
Sleeping
Sleeping
Commit History
-
role id fix
b81506c
-
feat(auth): Add user management endpoints with admin controls
- Add POST /users endpoint to create new user accounts with validation - Add GET /users endpoint to list users with pagination and status filtering - Add POST /users/list endpoint with advanced filtering, projection, and MongoDB optimization - Add GET /users/{user_id} endpoint to retrieve individual user details - Add PUT /users/{user_id} endpoint to update user information and roles - Add DELETE /users/{user_id} endpoint to soft-delete users with audit logging - Add POST /users/{user_id}/change-password endpoint for user password changes - Add POST /users/forgot-password endpoint for password reset flow - Add POST /users/verify-reset-token endpoint to validate reset tokens - Add POST /users/reset-password endpoint to complete password reset - Add POST /users/{user_id}/status endpoint to manage user status (active/inactive/suspended) - Implement require_admin_role dependency for authorization on all user management endpoints - Add comprehensive input validation for all user operations …cd28adc
-
feat(auth): Implement staff mobile OTP login and restructure user management routes
622d307
-
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
vanitha017e331 -
changed user_id as UUID
vanitha5fdb9fd
-
updates
e032470
-
feat(system_users): Complete staff mobile OTP login implementation with token generation
- Add necessary imports for datetime, logging, and service dependencies - Implement access token creation with configurable expiration from settings - Add token payload with user credentials (user_id, username, role, merchant details) - Convert user model to UserInfoResponse for response serialization - Return StaffMobileOTPLoginResponse with access token, token type, and expiration - Add login endpoint stub for standard authentication flow - Organize imports at module level for better code structure and maintainability7426dce -
fix(system_users): Reorganize router imports and definitions for proper initialization order
- Move router definition to top of file before any endpoint usage - Add missing FastAPI imports (APIRouter, Depends, HTTPException, status, Request) - Add HTTPAuthorizationCredentials import from fastapi.security - Remove duplicate router definition and imports from later in file - Clean up file structure to prevent router initialization issues - Ensure router is available for all endpoint decorators57100c8 -
fix: Correct type hint for user_info in StaffMobileOTPLoginResponse and adjust router definition placement
60b9eb5 -
feat: Implement staff mobile OTP login endpoint with validation and token generation
4fe4dba
-
feat: Enhance logout functionality with audit logging and security improvements
92a0975
-
feat: Implement forgot password feature with email reset functionality
- Added `FORGOT_PASSWORD_QUICKSTART.md` for quick reference on setup and usage. - Created `IMPLEMENTATION_SUMMARY.md` detailing the implementation process and features. - Introduced new API endpoints for password reset: `/auth/forgot-password`, `/auth/verify-reset-token`, and `/auth/reset-password`. - Developed email service in `app/utils/email_service.py` for sending transactional emails. - Updated configuration in `app/core/config.py` to include password reset settings. - Enhanced user service in `app/system_users/services/service.py` to handle password reset token creation, verification, and email sending. - Added schemas for password reset requests in `app/system_users/schemas/schema.py`. - Implemented token storage and management in `app/system_users/models/model.py`. - Created a test script `test_forgot_password.py` to validate the complete password reset flow. - Included troubleshooting and security features in documentation.96e0270 -
Implement structured logging system across AUTH Microservice
- Added JSONFormatter and StructuredLogger classes for structured logging. - Implemented setup_logging() and get_logger() functions for logging configuration. - Integrated structured logging into app/main.py, app/auth/controllers/router.py, app/system_users/controllers/router.py, app/dependencies/auth.py, app/nosql.py, app/cache.py, app/core/db_init.py, app/internal/router.py, and app/system_users/services/service.py. - Updated logging calls to include structured context and error handling. - Created comprehensive logging documentation (PRODUCTION_LOGGING_IMPLEMENTATION.md and PRODUCTION_LOGGING_SUMMARY.md) detailing logging architecture, usage, and best practices.755d6cd -
Enhance error handling and logging across authentication and user management endpoints
- Improved error handling in authentication dependencies to raise detailed HTTP exceptions for various failure scenarios. - Added logging for missing credentials, token verification failures, and database errors in authentication processes. - Enhanced user creation endpoints with validation checks for required fields and improved error responses. - Implemented detailed logging for user management actions, including creation, updates, and deactivation. - Added request logging middleware to track incoming requests and their processing times. - Standardized error responses for validation errors and database issues throughout the application. - Improved health check and database status endpoints with better error handling and logging.2d38c65
-
docs(merchant_type): Standardize merchant type references to lowercase
- Update MERCHANT_TYPE_IMPLEMENTATION.md to use lowercase `ncnf` instead of `NCNF` - Update model field descriptions in SystemUserModel to reference lowercase merchant types - Update schema field descriptions in CreateUserRequest to reference lowercase merchant types - Update router endpoint documentation to reference lowercase merchant types - Update initial user creation script to use lowercase `ncnf` for merchant_type values - Update demo script to use lowercase `ncnf` in merchant type filtering - Update test script to use lowercase `ncnf` in merchant type filtering - Ensures consistency across all merchant type references throughout the codebased74c068 -
docs(merchant_type): Update merchant type references from salon to retail and NCNF
- Update supported merchant types documentation from `national_cnf`, `cnf`, `distributor`, `salon` to `NCNF`, `cnf`, `distributor`, `retail` - Replace all `salon` references with `retail` across documentation and example code - Update role mapping from `role_salon_owner` to `role_retail_owner` in SCM permissions integration - Update example payloads and API documentation to use retail merchant type - Update model field descriptions and schema examples to reflect new merchant type values - Update test data and demo scripts to use retail instead of salon - Standardize merchant type naming conventions across all internal schemas and API endpoints349a6d0
-
feat(internal): Add internal API endpoints for system user creation from employees and merchants
- Create new internal API module with router and schemas for system user creation - Add `/internal/system-users/from-employee` endpoint for SCM service to create users from employee data - Add `/internal/system-users/from-merchant` endpoint for SCM service to create users from merchant data - Implement automatic username and password generation when not provided - Add metadata tracking for user creation source and origin (employee/merchant) - Update system user service to support internal API user creation with "system_internal" creator - Add migration script to update existing system users with merchant_type field - Include comprehensive logging for internal user creation operations - These endpoints enable seamless system user provisioning from external microservices (SCM, POS)5f1560e
-
feat(system_users): Add merchant_type field and list endpoint with projection support
- Add `merchant_type` field to SystemUserModel for merchant categorization - Implement automatic merchant_type detection from SCM service during user creation - Add optional `merchant_type` parameter to CreateUserRequest schema - Include `merchant_type` and `merchant_id` in UserInfoResponse schema - Create new `POST /auth/users/list` endpoint with projection support following API standards - Implement `list_users_with_projection()` service method with filtering by merchant_type, role, status, and merchant_id - Add `get_merchant_info()` service method to fetch merchant data from SCM service with fallback to database - Create comprehensive documentation in MERCHANT_TYPE_IMPLEMENTATION.md with usage examples and benefits - Add test script `test_system_users_with_merchant_type.py` for API validation - Add demo script `demo_merchant_type_users.py` for interactive testing - Update `create_initial_users.py` to support merchant_type initialization - Enable 50-90% response size reduction throug…a581666 -
feat(auth): Centralize token expiration and security configuration settings
- Add refresh token expiration, failed login attempts, account lock duration, and remember me token settings to environment configuration - Move hardcoded JWT constants (ALGORITHM, token expiration times) from service layer to centralized settings - Update login endpoints to use configurable TOKEN_EXPIRATION_HOURS instead of hardcoded 30-minute values - Implement dynamic expires_in calculation in login response based on actual token expiration - Add MAX_PAGE_SIZE configuration for API pagination limits - Replace hardcoded 24-hour remember me token with configurable REMEMBER_ME_TOKEN_HOURS setting - Consolidate all security-related configuration in core/config.py for easier maintenance and environment-specific overridesf836b0e
-
feat(system_users): Add merchant_id field to user model and authentication tokens
- Add merchant_id field to SystemUserModel to track user's associated merchant - Include merchant_id in JWT token payload for both auth and system_users login endpoints - Update CreateUserRequest schema to require merchant_id during user creation - Populate merchant_id when creating new users in service layer - Initialize all default users with merchant_id in database setup script - Fix refresh_token endpoint to return new_access_token instead of stale access_token - Standardize token payload structure across auth endpoints to include merchant_id - Update initial user creation logs to display merchant information and correct passwords8cd913e
-
refactor: update user role handling to use string identifiers instead of enum values
7e4a9fd -
user roles changes
8a8d7ba
-
feat: Implement System Users module for authentication and user management
- Added `system_users` package with controllers, models, schemas, and services. - Created API endpoints for user login, registration, user management, and password change. - Implemented JWT authentication and user role management. - Added database management utilities for creating indexes and default roles. - Updated requirements.txt with necessary dependencies for FastAPI, MongoDB, and JWT handling. - Created a startup script to set up the environment and run the FastAPI server.7a5b513