Skip to content

Tags: IDTS-LAB/python-codebase

Tags

v1.0.0

Toggle v1.0.0's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Merge branch 'development' into master

v0.0.3

Toggle v0.0.3's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Merge branch 'development' into master

v0.0.2

Toggle v0.0.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Development (#11)

* fix: login response

* feat: add email verification on register

* feat: add import boundary

* refactor: move authentication app to auth

* feat: implement sync commumication

* feat: implement sync commumication

* feat: implement sync commumication

* fix: import path

* refactor: restructure authorization module to follow DDD + Clean Architecture + CQRS

- Move authorization from core to dedicated module with full layer separation
- Create application layer with CQRS pattern (commands, queries, handlers)
- Rename 'presenter' to 'presentation' for consistency
- Organize domain services and infrastructure repositories properly
- Fix directory structure to match standard DDD boundaries
- Update imports and dependencies accordingly

* Add authorization infrastructure with Casbin policy management

- New SQLAlchemy models for authorization including CasbinRuleModel, PermissionModel, AuthorizationResourceModel, RoleModel, RolePermissionModel, and UserHasRoleModel with proper relationships and constraints
- Implementation of SQLAlchemyCasbinPolicyRepository with full CRUD operations for roles, permissions, and policies including cursor-based pagination
- CasbinAuthorizationService integrating with the repository layer and providing dynamic enforcer building for access control decisions
- Infrastructure setup for authorization module with proper domain entities, services, and repository patterns following the application architecture

This commit establishes a comprehensive authorization system backend with database persistence, supporting role-based access control through Casbin policies and efficient data management through SQLAlchemy ORM.

* fix: invalid import path

* docs: update readme

* Title: Refactor authorization infrastructure and update imports

Key features implemented:
- Updated import paths in CasbinAuthorizationService to reflect new core infrastructure location
- Updated import paths in GetRoleQueryHandler to reflect new core infrastructure location
- Updated import paths in dependency injection module to reflect new core infrastructure location
- Updated import paths in permission router to reflect new core infrastructure location
- Updated import paths in role router to reflect new core infrastructure location
- Removed old authorization infrastructure modules and models from src/modules/authorization/infrastructure/
- Streamlined .gitignore file with consolidated ignore patterns

The changes consolidate the authorization infrastructure under the core module and update all relevant imports across the application, removing redundant legacy infrastructure files.

* refactor: move infrastructure to module from core

* Title: Implement Normalized User Domain with DDD Structure and Update Handlers

Key features implemented:
- New docs/NORMALIZED_USER_DOMAIN.md detailing normalized schema design rationale and structure
- New src/modules/user/infrastructure/models/__init__.py aggregating all user domain models
- New src/modules/user/infrastructure/models/user_*_model.py files for normalized user entities (address, contact, profile, security, settings, verification)
- Updated src/modules/authorization/infrastructure/models/*_model.py with indexing optimizations
- Updated src/modules/user/application/auth/login_user/handler.py to reference password_hash correctly
- Updated src/modules/user/application/auth/register_user/handler.py to use password_hash in User.create
- Updated src/modules/user/application/detail_user/handler.py to fetch user with relations via get_by_id_with_relations
- Updated src/modules/user/domain/entities/user.py with normalized entity structure including profile, settings, security
- Updated src/modules/user/domain/repositories/user_repository.py interface for relation handling
- Updated src/modules/user/infrastructure/models/user_model.py to reflect normalized structure and relationships
- Updated src/modules/user/infrastructure/repositories/user_repository.py implementation for normalized data access

The changes implement a fully normalized user domain following DDD principles, separating concerns into distinct bounded contexts while updating application handlers to utilize the new structure. The repository layer now supports fetching related user data efficiently.

* fix: import path

* Refactor authorization models to remove circular imports and update gitignore

- Updated .gitignore with standard Python project exclusions and removed redundant entries
- Modified PermissionModel to remove direct imports and use string references for relationships
- Modified AuthorizationResourceModel to remove direct imports and use string references for relationships
- Modified RolePermissionModel to remove direct imports and use string references for relationships
- Modified UserHasRoleModel to remove direct imports and use string references for relationships

This change eliminates circular import dependencies between authorization models while maintaining all existing functionality and relationships. The gitignore file now follows standard conventions for Python projects.

* update branch

* update branch

* chore: remove all __pycache__

* chore: update gitignore

* chore: update gitignore

* fix: update migration

* docs: design normalized database seed update

* docs: plan normalized database seed update

* chore: ignore local worktrees

* test: cover normalized user seeding

* fix: align user seed with normalized schema

* docs: explain normalized database seeding

* Title: Restore Database Foreign Keys and Normalize User Identifiers

Key features implemented:
- Added comprehensive ORM relationship and foreign key metadata regression tests in test_database_relationships.py
- Restored missing foreign key constraints in authorization models (permission, role_permission, user_has_role) and todo model
- Converted normalized user identifier columns across 7 user models to UUID type with proper foreign key references
- Updated Alembic environment to load complete user model package for accurate metadata reflection
- Created corrective Alembic migration to convert string user IDs to UUID and create all missing foreign key constraints
- Added contract tests for the corrective migration covering both upgrade and downgrade operations

The implementation restores all 13 intended foreign keys while ensuring normalized user identifiers use UUID consistently, enabling successful database seeding without SQLAlchemy mapper errors.

* docs: design foreign key restoration

* docs: plan foreign key restoration

* fix: table data type

* fix: todo owner

* chore: update initial schemas

* fix: update detail /me endpoint

* Implement user account lockout and multi-method 2FA

- Added TwoFactorAuthService supporting TOTP (Google Authenticator) and email-based 2FA with backup codes
- Implemented 2FA setup, verification, disabling, and regeneration commands with corresponding handlers
- Created new API router and request/response schemas for 2FA endpoints
- Updated LoginUserCommandHandler to integrate 2FA verification and temporary token generation
- Enhanced account lockout mechanism to prevent brute force login attempts
- Added dependency injection for new 2FA handlers and integrated with existing auth flow

* feat: 2fa implementation

---------

Co-authored-by: qwen.ai[bot] <qwenlm-intl@service.alibaba.com>

v0.0.1

Toggle v0.0.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #2 from IDTS-LAB/development

fix: security scan