identity-plan-kit 1.0.3__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- identity_plan_kit-1.2.0/.serena/project.yml +189 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/PKG-INFO +7 -7
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/README.md +1 -1
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/pyproject.toml +6 -6
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/admin/views.py +19 -27
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/services/oauth_service.py +15 -15
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/config.py +5 -3
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/constants.py +1 -1
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_oauth_service_resilience.py +6 -6
- identity_plan_kit-1.2.0/tests/integration/test_admin_permissions.py +126 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_e2e_endpoints.py +1 -1
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_config_validation.py +14 -3
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/uv.lock +1546 -1479
- identity_plan_kit-1.0.3/.serena/cache/python/document_symbols.pkl +0 -0
- identity_plan_kit-1.0.3/.serena/cache/python/raw_document_symbols.pkl +0 -0
- identity_plan_kit-1.0.3/.serena/memories/memory_maintenance.md +0 -33
- identity_plan_kit-1.0.3/.serena/project.yml +0 -133
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/CLAUDE.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/agents/Architect.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/agents/Reviewer.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/cache-standards.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/crud-operations.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/database-patterns.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/error-handling.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/feature-structure.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/layer-standards.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/no-speculative-changes.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/rules/serena-tool-selection.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/settings.local.json +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/architect-review/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/code-review/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/pattern-review/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/production-readiness-review/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/real-optimization-test/SKILL.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/security-review/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/system-design/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/task-creator/SKILL.MD +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.claude/skills/testing-review/SKILL.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.gitignore +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.mcp.json +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.serena/.gitignore +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/.serena/project.local.yml +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/AUDIT_REPORT.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/Makefile +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/env.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/script.py.mako +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20250124_000000_initial_schema.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20250127_000000_add_password_hash.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20250130_000000_add_display_name_picture.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20250214_000000_add_user_metadata.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20260506_000000_add_plan_timestamps.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20260515_000000_add_auth_timestamps.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic/versions/20260610_000000_add_rbac_timestamps.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/alembic.ini +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/extending_models.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/integration/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/integration/fastapi_integration.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/integration/sample_alembic_env.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/integration/webhook_integration.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/playing/admin_usage.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/playing/basic_usage.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/playing/custom_error_formats.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/playing/user_metadata.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/prod/.env.production.example +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/prod/Dockerfile +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/prod/docker-compose.yml +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/prod/nginx.conf +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/prod/production_setup.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/examples/prod/prometheus.yml +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/README.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/config.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/locustfile.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/test_auth.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/test_database_stress.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/test_mixed_scenarios.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/test_plans_quota.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/test_quota_direct.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/test_rbac_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/loadtests/utils.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/pyrightconfig.json +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/admin/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/admin/auth.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/cache/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/cache/auth_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/dependencies.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/domain/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/domain/entities.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/domain/exceptions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/dto/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/dto/requests.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/dto/responses.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/handlers/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/handlers/oauth_routes.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/models/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/models/refresh_token.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/models/user.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/models/user_provider.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/repositories/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/repositories/token_repo.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/repositories/user_repo.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/services/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/services/auth_service.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/auth/uow.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/cli.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/exception_handlers.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/kit.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/migrations.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/cache/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/cache/exceptions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/cache/plan_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/cache/serializers.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/cache/user_plan_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/dependencies.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/domain/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/domain/entities.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/domain/exceptions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/dto/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/dto/responses.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/dto/usage.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/handlers/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/handlers/plan_routes.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/feature.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/feature_usage.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/plan.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/plan_limit.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/plan_permission.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/models/user_plan.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/repositories/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/repositories/plan_repo.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/repositories/usage_repo.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/services/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/services/plan_service.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/plans/uow.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/py.typed +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/cache/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/cache/permission_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/dependencies.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/domain/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/domain/entities.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/domain/exceptions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/models/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/models/permission.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/models/role.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/models/role_permission.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/repositories/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/repositories/rbac_repo.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/services/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/services/rbac_service.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/rbac/uow.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/registry.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/README.md +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/audit.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/circuit_breaker.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/cleanup_scheduler.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/database.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/error_formatter.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/exception_handlers.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/exceptions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/graceful_shutdown.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/health.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/http_utils.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/lockout.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/logging.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/metrics.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/models.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/protocols.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/rate_limiter.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/registry.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/repository.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/request_id.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/schemas.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/security.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/state_store.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/uow.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/uuid7.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/test_app.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/admin/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_audit_regressions_2026_06.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_auth_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_auth_cache_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_auth_service.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_circuit_breaker.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_csrf_state.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_dependencies.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_domain_entities.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_http_utils.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_lockout.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_lockout_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_oauth_semaphore_timeout.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_redis_auth_cache_lua.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_review_regressions_2026_05.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_security_comprehensive.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_token_security.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/conftest.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/extension/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/extension/conftest.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/extension/test_model_extension.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/conftest.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_concurrent_limit_merge.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_concurrent_plan_operations.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_concurrent_service_races.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_concurrent_token_operations.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_concurrent_user_creation.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_concurrent_user_deactivation.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_limit_boundaries.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_plan_cache_race.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_quota_concurrency.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_redis_stale_write_prevention.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_token_cleanup.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_token_repository.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_usage_periods.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/integration/test_user_repository.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_circuit_breaker_behavior.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_dependencies.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_domain_entities.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_period_edge_cases.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_plan_cache_bounded_invalidation.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_plan_cache_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_plan_cache_interleave.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_plan_service.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_plan_service_cache_ordering.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_plan_service_stampede.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_quota_idempotency_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_redis_plan_cache_set_all.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_review_regression_2026_05.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_review_regression_2026_05_06.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/plans/test_user_plan_cache_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/__init__.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_permission_cache.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_permission_cache_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_rbac_cache_stampede.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_rbac_service.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_rbac_service_stampede_real.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_review_2026_05_06_regressions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/rbac/test_review_regressions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_audit_pii_masking.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_circuit_breaker_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_cleanup_scheduler_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_constants.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_exception_handlers.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_http_utils_security.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_rate_limiter.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_rate_limiter_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_review_regressions.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_state_store_concurrent.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_state_store_resilience.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/shared/test_uow.py +0 -0
- {identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/test_kit_wiring.py +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# the name by which the project can be referenced within Serena/when chatting with the LLM.
|
|
2
|
+
project_name: "identity-plan-kit"
|
|
3
|
+
|
|
4
|
+
# list of language servers to start when using the LSP backend; choose from:
|
|
5
|
+
# ada al angular ansible astro
|
|
6
|
+
# bash bsl clojure cpp cpp_ccls
|
|
7
|
+
# crystal csharp csharp_omnisharp cue dart
|
|
8
|
+
# deno elixir elm erlang fortran
|
|
9
|
+
# fsharp gdscript gleam go groovy
|
|
10
|
+
# haskell haxe hlsl html java
|
|
11
|
+
# json julia julia_fatou kotlin latex
|
|
12
|
+
# lean4 lua lua_emmylua luau markdown
|
|
13
|
+
# matlab msl nextflow nix ocaml
|
|
14
|
+
# pascal perl php php_devsense php_phpactor
|
|
15
|
+
# php_phpantom powershell python python_basedpyright python_jedi
|
|
16
|
+
# python_pyrefly python_ty qml r rego
|
|
17
|
+
# ruby ruby_solargraph rust scala scss
|
|
18
|
+
# solidity svelte swift systemverilog terraform
|
|
19
|
+
# toml typescript typescript_tsgo typescript_vts vue
|
|
20
|
+
# vbnet wolfram yaml zig
|
|
21
|
+
# (This list may be outdated; generated with scripts/print_language_list.py;
|
|
22
|
+
# For the current list, see values of the LanguageServerId enum here:
|
|
23
|
+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py)
|
|
24
|
+
# For some languages, there are several alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
|
|
25
|
+
# Note:
|
|
26
|
+
# - For C, use cpp
|
|
27
|
+
# - For JavaScript, use typescript
|
|
28
|
+
# - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
|
|
29
|
+
# - For Astro projects, use astro (subsumes typescript/javascript for .astro projects; requires npm)
|
|
30
|
+
# - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
|
|
31
|
+
# - For Deno projects, use deno (serves the same .ts/.js files as typescript; requires the deno CLI on PATH)
|
|
32
|
+
# - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
|
|
33
|
+
# - For Free Pascal/Lazarus, use pascal
|
|
34
|
+
# - External Python adapters may add further registered IDs; install the adapter package first
|
|
35
|
+
# and then use its ID here, for example: example
|
|
36
|
+
# Special requirements:
|
|
37
|
+
# Some language servers require additional setup/installations.
|
|
38
|
+
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
|
|
39
|
+
# When using multiple language servers, the first language server that supports a given file will be used for that file.
|
|
40
|
+
# The first language server is the default language and the respective language server will be used as a fallback.
|
|
41
|
+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
|
42
|
+
language_servers:
|
|
43
|
+
- python
|
|
44
|
+
|
|
45
|
+
# the encoding used by text files in the project
|
|
46
|
+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
|
|
47
|
+
encoding: "utf-8"
|
|
48
|
+
|
|
49
|
+
# optional shell command to run before the language backend (LSP or JetBrains) is initialised.
|
|
50
|
+
# the command runs in the project root directory and is only executed if the project is trusted
|
|
51
|
+
# (see trusted_project_path_patterns in the global configuration).
|
|
52
|
+
# serena waits for the command to exit: a non-zero exit code is logged as an error but does not
|
|
53
|
+
# abort activation. a per-project timeout (activation_command_timeout, default 180s) is the safety
|
|
54
|
+
# backstop for non-terminating commands; on expiry the process is killed and activation continues.
|
|
55
|
+
# example: activation_command: "npx nx run-many -t build"
|
|
56
|
+
activation_command:
|
|
57
|
+
|
|
58
|
+
# maximum time in seconds to wait for activation_command to complete before killing it (default 180s).
|
|
59
|
+
# must be a positive number.
|
|
60
|
+
activation_command_timeout: 180.0
|
|
61
|
+
|
|
62
|
+
# line ending convention to use when writing source files.
|
|
63
|
+
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
|
|
64
|
+
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
|
|
65
|
+
line_ending:
|
|
66
|
+
|
|
67
|
+
# The language backend to use for this project.
|
|
68
|
+
# If not set, the global setting from serena_config.yml is used.
|
|
69
|
+
# Valid values: LSP, JetBrains
|
|
70
|
+
# Note: the backend is fixed at startup. If a project with a different backend
|
|
71
|
+
# is activated post-init, an error will be returned.
|
|
72
|
+
language_backend:
|
|
73
|
+
|
|
74
|
+
# The interface through which the agent (LLM) accesses Serena's functionality (overrides the global setting).
|
|
75
|
+
# Valid values: tools, REPL (see the global configuration for details); leave empty to use the global setting.
|
|
76
|
+
# Note: the interface is fixed at startup. If a project is activated post-init, its setting is not applied.
|
|
77
|
+
agent_interface:
|
|
78
|
+
|
|
79
|
+
# whether to use project's .gitignore files to ignore files
|
|
80
|
+
ignore_all_files_in_gitignore: true
|
|
81
|
+
|
|
82
|
+
# advanced configuration option allowing to configure language server-specific options.
|
|
83
|
+
# Maps the language key to the options.
|
|
84
|
+
# The settings are considered only if the project is trusted (see global configuration to define trusted projects).
|
|
85
|
+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#language-server-specific-settings
|
|
86
|
+
ls_specific_settings: {}
|
|
87
|
+
|
|
88
|
+
# list of workspace folder paths (LSP backend only).
|
|
89
|
+
# These folders will be used to build up Serena's symbol index.
|
|
90
|
+
# Paths must be within the project root and should thus be relative to the project root.
|
|
91
|
+
# Furthermore, the paths should not be filtered by ignore settings.
|
|
92
|
+
# Default setting: The entire project root folder (".") is considered.
|
|
93
|
+
# In (large) monorepos, this can be used to index only subfolders of the project root, e.g.
|
|
94
|
+
# ls_workspace_folders:
|
|
95
|
+
# - "./subproject1"
|
|
96
|
+
# - "./subproject2"
|
|
97
|
+
ls_workspace_folders:
|
|
98
|
+
- "."
|
|
99
|
+
|
|
100
|
+
# list of additional workspace folder paths for cross-package reference support.
|
|
101
|
+
# Paths can be absolute or relative to the project root.
|
|
102
|
+
# Each folder is registered as an LSP workspace folder, enabling language servers to discover
|
|
103
|
+
# symbols and references across package boundaries, but these folders are not indexed by Serena,
|
|
104
|
+
# i.e. the respective symbols will not be found using Serena's symbol search tools.
|
|
105
|
+
# Example:
|
|
106
|
+
# additional_workspace_folders:
|
|
107
|
+
# - ../sibling-package
|
|
108
|
+
# - ../shared-lib
|
|
109
|
+
ls_additional_workspace_folders: []
|
|
110
|
+
|
|
111
|
+
# list of additional paths to ignore in this project.
|
|
112
|
+
# Same syntax as gitignore, so you can use * and **.
|
|
113
|
+
# Important: quote patterns that start with `*`, otherwise YAML treats them as aliases.
|
|
114
|
+
# Example:
|
|
115
|
+
# ignored_paths:
|
|
116
|
+
# - "examples/**"
|
|
117
|
+
# - ".worktrees/**"
|
|
118
|
+
# - "**/bin/**"
|
|
119
|
+
# - "**/obj/**"
|
|
120
|
+
# Note: global ignored_paths from serena_config.yml are also applied additively.
|
|
121
|
+
ignored_paths: []
|
|
122
|
+
|
|
123
|
+
# whether the project is in read-only mode
|
|
124
|
+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
|
125
|
+
# Added on 2025-04-18
|
|
126
|
+
read_only: false
|
|
127
|
+
|
|
128
|
+
# list of tool names (and tool markers) to exclude.
|
|
129
|
+
# This extends the existing exclusions (e.g. from the global configuration)
|
|
130
|
+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
|
131
|
+
excluded_tools: []
|
|
132
|
+
|
|
133
|
+
# list of tools (and tool markers) to include that would otherwise be disabled (particularly optional tools
|
|
134
|
+
# that are disabled by default).
|
|
135
|
+
# This extends the existing inclusions (e.g. from the global configuration).
|
|
136
|
+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
|
137
|
+
included_optional_tools: []
|
|
138
|
+
|
|
139
|
+
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
|
|
140
|
+
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
|
|
141
|
+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
|
142
|
+
fixed_tools: []
|
|
143
|
+
|
|
144
|
+
# list of APIs (facades or facade methods, e.g. "lsp" or "lsp.find_symbol") to exclude from the REPL.
|
|
145
|
+
# Add "marker:editing" to exclude all editing functions.
|
|
146
|
+
# This extends the existing exclusions (e.g. from the global configuration).
|
|
147
|
+
excluded_apis: []
|
|
148
|
+
|
|
149
|
+
# list of APIs (facades or facade methods, e.g. "lsp" or "lsp.get_diagnostics_for_symbol") to include in the REPL
|
|
150
|
+
# that would otherwise be disabled (particularly optional methods, which are disabled by default).
|
|
151
|
+
# This extends the existing inclusions (e.g. from the global configuration).
|
|
152
|
+
included_apis: []
|
|
153
|
+
|
|
154
|
+
# list of mode names that are to be activated by default, overriding the setting in the global configuration.
|
|
155
|
+
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
|
|
156
|
+
# If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
|
|
157
|
+
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
|
|
158
|
+
# Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
|
|
159
|
+
# for this project.
|
|
160
|
+
# This setting can, in turn, be overridden by CLI parameters (--mode).
|
|
161
|
+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
|
|
162
|
+
default_modes:
|
|
163
|
+
|
|
164
|
+
# list of mode names to be activated additionally for this project, e.g. ["query-projects"]
|
|
165
|
+
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
|
|
166
|
+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
|
|
167
|
+
added_modes:
|
|
168
|
+
|
|
169
|
+
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
|
170
|
+
# (contrary to the memories, which are loaded on demand).
|
|
171
|
+
initial_prompt: ""
|
|
172
|
+
|
|
173
|
+
# time budget (seconds) per tool call for the retrieval of additional symbol information
|
|
174
|
+
# such as docstrings or parameter information.
|
|
175
|
+
# This overrides the corresponding setting in the global configuration; see the documentation there.
|
|
176
|
+
# If null or missing, use the setting from the global configuration.
|
|
177
|
+
symbol_info_budget:
|
|
178
|
+
|
|
179
|
+
# list of regex patterns which, when matched, mark a memory entry as read‑only.
|
|
180
|
+
# Extends the list from the global configuration, merging the two lists.
|
|
181
|
+
read_only_memory_patterns: []
|
|
182
|
+
|
|
183
|
+
# list of regex patterns for memories to completely ignore.
|
|
184
|
+
# Matching memories will not appear in list_memories or activate_project output
|
|
185
|
+
# and cannot be accessed via read_memory or write_memory.
|
|
186
|
+
# To access ignored memory files, use the read_file tool on the raw file path.
|
|
187
|
+
# Extends the list from the global configuration, merging the two lists.
|
|
188
|
+
# Example: ["_archive/.*", "_episodes/.*"]
|
|
189
|
+
ignored_memory_patterns: []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: identity-plan-kit
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Modern FastAPI library for authentication, RBAC, subscription plans, and usage tracking
|
|
5
5
|
Author-email: harut <harut.avetisyan2002@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -19,10 +19,10 @@ Classifier: Typing :: Typed
|
|
|
19
19
|
Requires-Python: >=3.11
|
|
20
20
|
Requires-Dist: alembic>=1.14.0
|
|
21
21
|
Requires-Dist: asyncpg>=0.30.0
|
|
22
|
-
Requires-Dist: authlib>=1.
|
|
22
|
+
Requires-Dist: authlib>=1.9.10
|
|
23
23
|
Requires-Dist: bcrypt<5.0.0,>=4.0.0
|
|
24
24
|
Requires-Dist: fastapi>=0.115.0
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: httpx2>=2.16.2
|
|
26
26
|
Requires-Dist: itsdangerous>=2.2.0
|
|
27
27
|
Requires-Dist: orjson>=3.10.0
|
|
28
28
|
Requires-Dist: passlib[bcrypt]>=1.7.4
|
|
@@ -38,12 +38,12 @@ Requires-Dist: tenacity>=9.0.0
|
|
|
38
38
|
Requires-Dist: typer>=0.12.0
|
|
39
39
|
Requires-Dist: uuid-utils>=0.10.0
|
|
40
40
|
Provides-Extra: admin
|
|
41
|
-
Requires-Dist: sqladmin>=0.
|
|
41
|
+
Requires-Dist: sqladmin>=0.32.0; extra == 'admin'
|
|
42
42
|
Provides-Extra: cli
|
|
43
43
|
Requires-Dist: python-dotenv>=1.0.0; extra == 'cli'
|
|
44
44
|
Provides-Extra: dev
|
|
45
45
|
Requires-Dist: bump-my-version>=0.26.0; extra == 'dev'
|
|
46
|
-
Requires-Dist:
|
|
46
|
+
Requires-Dist: httpx2>=2.16.2; extra == 'dev'
|
|
47
47
|
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
|
|
48
48
|
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
49
49
|
Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
|
|
@@ -624,7 +624,7 @@ All configuration is via environment variables or `IdentityPlanKitConfig`:
|
|
|
624
624
|
| `IPK_ENABLE_AUTO_CLEANUP` | Auto cleanup expired tokens | `true` |
|
|
625
625
|
| `IPK_CLEANUP_INTERVAL_HOURS` | Cleanup interval in hours | `6.0` |
|
|
626
626
|
| `IPK_DATABASE_STATEMENT_TIMEOUT_MS` | PostgreSQL statement timeout | `30000` |
|
|
627
|
-
| `IPK_TOKEN_REFRESH_IDEMPOTENCY_TTL_SECONDS` | Token refresh idempotency window | `
|
|
627
|
+
| `IPK_TOKEN_REFRESH_IDEMPOTENCY_TTL_SECONDS` | Token refresh idempotency / reuse-detection grace window (5-600) | `300` |
|
|
628
628
|
| `IPK_QUOTA_IDEMPOTENCY_TTL_SECONDS` | Quota consumption idempotency window | `60` |
|
|
629
629
|
| `IPK_REQUIRE_REDIS` | Fail if Redis unavailable | Auto (true in prod) |
|
|
630
630
|
|
|
@@ -560,7 +560,7 @@ All configuration is via environment variables or `IdentityPlanKitConfig`:
|
|
|
560
560
|
| `IPK_ENABLE_AUTO_CLEANUP` | Auto cleanup expired tokens | `true` |
|
|
561
561
|
| `IPK_CLEANUP_INTERVAL_HOURS` | Cleanup interval in hours | `6.0` |
|
|
562
562
|
| `IPK_DATABASE_STATEMENT_TIMEOUT_MS` | PostgreSQL statement timeout | `30000` |
|
|
563
|
-
| `IPK_TOKEN_REFRESH_IDEMPOTENCY_TTL_SECONDS` | Token refresh idempotency window | `
|
|
563
|
+
| `IPK_TOKEN_REFRESH_IDEMPOTENCY_TTL_SECONDS` | Token refresh idempotency / reuse-detection grace window (5-600) | `300` |
|
|
564
564
|
| `IPK_QUOTA_IDEMPOTENCY_TTL_SECONDS` | Quota consumption idempotency window | `60` |
|
|
565
565
|
| `IPK_REQUIRE_REDIS` | Fail if Redis unavailable | Auto (true in prod) |
|
|
566
566
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "identity-plan-kit"
|
|
3
|
-
version = "1.0
|
|
3
|
+
version = "1.2.0"
|
|
4
4
|
description = "Modern FastAPI library for authentication, RBAC, subscription plans, and usage tracking"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -30,8 +30,8 @@ dependencies = [
|
|
|
30
30
|
"sqlalchemy[asyncio]>=2.0.0",
|
|
31
31
|
"asyncpg>=0.30.0",
|
|
32
32
|
"alembic>=1.14.0",
|
|
33
|
-
"
|
|
34
|
-
"authlib>=1.
|
|
33
|
+
"httpx2>=2.16.2",
|
|
34
|
+
"authlib>=1.9.10",
|
|
35
35
|
"passlib[bcrypt]>=1.7.4",
|
|
36
36
|
"bcrypt>=4.0.0,<5.0.0", # Pin bcrypt <5 for passlib compatibility
|
|
37
37
|
"uuid-utils>=0.10.0",
|
|
@@ -51,7 +51,7 @@ dev = [
|
|
|
51
51
|
"pytest>=8.0.0",
|
|
52
52
|
"pytest-asyncio>=0.24.0",
|
|
53
53
|
"pytest-cov>=6.0.0",
|
|
54
|
-
"
|
|
54
|
+
"httpx2>=2.16.2",
|
|
55
55
|
"ruff>=0.8.0",
|
|
56
56
|
"ty>=0.0.47",
|
|
57
57
|
"pre-commit>=4.0.0",
|
|
@@ -69,7 +69,7 @@ metrics = [
|
|
|
69
69
|
"prometheus-client>=0.20.0",
|
|
70
70
|
]
|
|
71
71
|
admin = [
|
|
72
|
-
"sqladmin>=0.
|
|
72
|
+
"sqladmin>=0.32.0",
|
|
73
73
|
]
|
|
74
74
|
redis = [
|
|
75
75
|
"redis[hiredis]>=5.0.0",
|
|
@@ -158,7 +158,7 @@ testpaths = ["tests"]
|
|
|
158
158
|
addopts = "-v --tb=short"
|
|
159
159
|
|
|
160
160
|
[tool.bumpversion]
|
|
161
|
-
current_version = "1.0
|
|
161
|
+
current_version = "1.2.0"
|
|
162
162
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
163
163
|
serialize = ["{major}.{minor}.{patch}"]
|
|
164
164
|
tag = true
|
|
@@ -10,11 +10,11 @@ Provides pre-configured admin views for all models:
|
|
|
10
10
|
from __future__ import annotations
|
|
11
11
|
|
|
12
12
|
import os
|
|
13
|
-
from pathlib import Path
|
|
14
13
|
from typing import TYPE_CHECKING, Any
|
|
15
14
|
from uuid import UUID
|
|
16
15
|
|
|
17
16
|
from sqladmin import Admin, ModelView
|
|
17
|
+
from sqladmin.authorization import Action
|
|
18
18
|
from sqlalchemy.exc import IntegrityError
|
|
19
19
|
from starlette.requests import Request
|
|
20
20
|
from wtforms import validators
|
|
@@ -38,6 +38,9 @@ from identity_plan_kit.shared.logging import get_logger
|
|
|
38
38
|
|
|
39
39
|
logger = get_logger(__name__)
|
|
40
40
|
|
|
41
|
+
# SQLAdmin actions restricted to superadmin; list/details/export stay open to admins.
|
|
42
|
+
_WRITE_ACTIONS = frozenset({Action.CREATE, Action.EDIT, Action.DELETE, Action.IMPORT})
|
|
43
|
+
|
|
41
44
|
if TYPE_CHECKING:
|
|
42
45
|
from fastapi import FastAPI
|
|
43
46
|
from sqlalchemy.ext.asyncio import AsyncEngine
|
|
@@ -117,8 +120,9 @@ class BaseAdminView(ModelView):
|
|
|
117
120
|
The permission checking uses the AdminAuthBackend from the request's
|
|
118
121
|
app state when available.
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
UI button visibility is controlled per request via ``has_permission``,
|
|
124
|
+
which SQLAdmin consults for every create/edit/delete/import button and
|
|
125
|
+
route. It reads the session on each call, so it is safe even though
|
|
122
126
|
ModelView instances are singletons shared across requests.
|
|
123
127
|
"""
|
|
124
128
|
|
|
@@ -159,11 +163,17 @@ class BaseAdminView(ModelView):
|
|
|
159
163
|
|
|
160
164
|
Requires an authenticated session. Both superadmin and admin can view;
|
|
161
165
|
write actions are gated by insert_model/update_model/delete_model
|
|
162
|
-
which call _is_superadmin directly.
|
|
163
|
-
buttons
|
|
166
|
+
which call _is_superadmin directly. has_permission additionally hides
|
|
167
|
+
write buttons and blocks write routes for non-superadmins.
|
|
164
168
|
"""
|
|
165
169
|
return bool(request.session.get("admin_authenticated"))
|
|
166
170
|
|
|
171
|
+
def has_permission(self, request: Request, action: str, obj: Any | None = None) -> bool:
|
|
172
|
+
"""Only superadmin may create, edit, delete, or import records."""
|
|
173
|
+
if action in _WRITE_ACTIONS and not self._is_superadmin(request):
|
|
174
|
+
return False
|
|
175
|
+
return super().has_permission(request, action, obj)
|
|
176
|
+
|
|
167
177
|
async def on_model_change(
|
|
168
178
|
self, data: dict[str, Any], model: Any, is_created: bool, request: Request
|
|
169
179
|
) -> None:
|
|
@@ -1130,19 +1140,16 @@ def setup_admin(
|
|
|
1130
1140
|
base_url=base_url,
|
|
1131
1141
|
)
|
|
1132
1142
|
|
|
1133
|
-
#
|
|
1134
|
-
#
|
|
1135
|
-
if templates_dir is None:
|
|
1136
|
-
templates_dir = str(Path(__file__).parent / "templates")
|
|
1137
|
-
|
|
1138
|
-
# Build kwargs
|
|
1143
|
+
# Build kwargs. Role-based button visibility comes from
|
|
1144
|
+
# BaseAdminView.has_permission, so SQLAdmin's stock templates suffice.
|
|
1139
1145
|
admin_kwargs: dict[str, Any] = {
|
|
1140
1146
|
"app": app,
|
|
1141
1147
|
"engine": engine,
|
|
1142
1148
|
"title": title,
|
|
1143
1149
|
"base_url": base_url,
|
|
1144
|
-
"templates_dir": templates_dir,
|
|
1145
1150
|
}
|
|
1151
|
+
if templates_dir is not None:
|
|
1152
|
+
admin_kwargs["templates_dir"] = templates_dir
|
|
1146
1153
|
if authentication_backend is not None:
|
|
1147
1154
|
admin_kwargs["authentication_backend"] = authentication_backend
|
|
1148
1155
|
|
|
@@ -1164,21 +1171,6 @@ def setup_admin(
|
|
|
1164
1171
|
"user_plan": user_plan_cache,
|
|
1165
1172
|
}
|
|
1166
1173
|
|
|
1167
|
-
# Add Jinja2 global function for role-based permission checking in templates.
|
|
1168
|
-
# This is thread-safe because it checks request.session on each call,
|
|
1169
|
-
# unlike modifying ModelView instance attributes which are shared.
|
|
1170
|
-
def is_superadmin_user(request: Request) -> bool:
|
|
1171
|
-
"""Check if current user is superadmin (for use in templates)."""
|
|
1172
|
-
if authentication_backend and hasattr(authentication_backend, "is_superadmin"):
|
|
1173
|
-
return authentication_backend.is_superadmin(request)
|
|
1174
|
-
# SECURITY: Deny by default when no auth backend is configured
|
|
1175
|
-
return False
|
|
1176
|
-
|
|
1177
|
-
# Jinja2's Environment.globals is an untyped dict; widen so the checker
|
|
1178
|
-
# accepts adding our template helper.
|
|
1179
|
-
template_globals: dict[str, Any] = admin.templates.env.globals
|
|
1180
|
-
template_globals["is_superadmin_user"] = is_superadmin_user
|
|
1181
|
-
|
|
1182
1174
|
for view in get_all_admin_views():
|
|
1183
1175
|
admin.add_view(view)
|
|
1184
1176
|
|
|
@@ -5,7 +5,7 @@ import secrets
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from typing import Any, cast
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import httpx2
|
|
9
9
|
from authlib.integrations.httpx_client import AsyncOAuth2Client
|
|
10
10
|
from tenacity import (
|
|
11
11
|
before_sleep_log,
|
|
@@ -34,7 +34,7 @@ GOOGLE_USERINFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo"
|
|
|
34
34
|
|
|
35
35
|
# HTTP timeout configuration. Connect/pool kept tight; read/write longer to
|
|
36
36
|
# accommodate occasional Google latency on userinfo.
|
|
37
|
-
HTTP_TIMEOUT =
|
|
37
|
+
HTTP_TIMEOUT = httpx2.Timeout(
|
|
38
38
|
connect=5.0,
|
|
39
39
|
read=10.0,
|
|
40
40
|
write=10.0,
|
|
@@ -43,11 +43,11 @@ HTTP_TIMEOUT = httpx.Timeout(
|
|
|
43
43
|
|
|
44
44
|
# Retry only on transient network errors. HTTP 4xx (bad request) is never retried.
|
|
45
45
|
RETRYABLE_EXCEPTIONS = (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
httpx2.ConnectError,
|
|
47
|
+
httpx2.ConnectTimeout,
|
|
48
|
+
httpx2.ReadTimeout,
|
|
49
|
+
httpx2.WriteTimeout,
|
|
50
|
+
httpx2.PoolTimeout,
|
|
51
51
|
OSError,
|
|
52
52
|
ConnectionError,
|
|
53
53
|
)
|
|
@@ -259,7 +259,7 @@ class GoogleOAuthService:
|
|
|
259
259
|
try:
|
|
260
260
|
await self._acquire_semaphore()
|
|
261
261
|
acquired = True
|
|
262
|
-
# authlib's AsyncOAuth2Client subclasses
|
|
262
|
+
# authlib's AsyncOAuth2Client subclasses httpx2.AsyncClient (a real
|
|
263
263
|
# async context manager), but its stubs omit __aenter__/__aexit__,
|
|
264
264
|
# so type checkers misread the `async with` form — manage the
|
|
265
265
|
# client lifecycle explicitly instead.
|
|
@@ -277,13 +277,13 @@ class GoogleOAuthService:
|
|
|
277
277
|
)
|
|
278
278
|
logger.debug("oauth_code_exchanged", provider="google")
|
|
279
279
|
return dict(token)
|
|
280
|
-
except
|
|
280
|
+
except httpx2.TimeoutException:
|
|
281
281
|
logger.warning(
|
|
282
282
|
"oauth_code_exchange_timeout",
|
|
283
283
|
provider="google",
|
|
284
284
|
)
|
|
285
285
|
raise
|
|
286
|
-
except
|
|
286
|
+
except httpx2.HTTPStatusError as e:
|
|
287
287
|
if HTTP_CLIENT_ERROR_MIN <= e.response.status_code < HTTP_CLIENT_ERROR_MAX:
|
|
288
288
|
logger.exception(
|
|
289
289
|
"oauth_code_exchange_client_error",
|
|
@@ -311,9 +311,9 @@ class GoogleOAuthService:
|
|
|
311
311
|
provider="google",
|
|
312
312
|
) from e
|
|
313
313
|
finally:
|
|
314
|
-
# cast: authlib's stubs omit the
|
|
314
|
+
# cast: authlib's stubs omit the httpx2.AsyncClient base
|
|
315
315
|
# surface entirely (aclose, __aenter__, ...).
|
|
316
|
-
await cast("
|
|
316
|
+
await cast("httpx2.AsyncClient", client).aclose()
|
|
317
317
|
finally:
|
|
318
318
|
if acquired:
|
|
319
319
|
self._semaphore.release()
|
|
@@ -372,7 +372,7 @@ class GoogleOAuthService:
|
|
|
372
372
|
try:
|
|
373
373
|
await self._acquire_semaphore()
|
|
374
374
|
acquired = True
|
|
375
|
-
async with
|
|
375
|
+
async with httpx2.AsyncClient(timeout=HTTP_TIMEOUT) as client:
|
|
376
376
|
try:
|
|
377
377
|
response = await client.get(
|
|
378
378
|
GOOGLE_USERINFO_URL,
|
|
@@ -396,14 +396,14 @@ class GoogleOAuthService:
|
|
|
396
396
|
family_name=data.get("family_name"),
|
|
397
397
|
picture=data.get("picture"),
|
|
398
398
|
)
|
|
399
|
-
except
|
|
399
|
+
except httpx2.TimeoutException:
|
|
400
400
|
logger.warning(
|
|
401
401
|
"oauth_user_info_timeout",
|
|
402
402
|
provider="google",
|
|
403
403
|
)
|
|
404
404
|
# Re-raise for retry
|
|
405
405
|
raise
|
|
406
|
-
except
|
|
406
|
+
except httpx2.HTTPStatusError as e:
|
|
407
407
|
# HTTP errors - don't retry 4xx
|
|
408
408
|
if HTTP_CLIENT_ERROR_MIN <= e.response.status_code < HTTP_CLIENT_ERROR_MAX:
|
|
409
409
|
logger.exception(
|
|
@@ -442,11 +442,13 @@ class IdentityPlanKitConfig(BaseSettings):
|
|
|
442
442
|
|
|
443
443
|
# Token refresh idempotency
|
|
444
444
|
token_refresh_idempotency_ttl_seconds: int = Field(
|
|
445
|
-
default=
|
|
445
|
+
default=300,
|
|
446
446
|
ge=5,
|
|
447
|
-
le=
|
|
447
|
+
le=600,
|
|
448
448
|
description="TTL for token refresh idempotency cache in seconds. "
|
|
449
|
-
"Allows clients to safely retry refresh requests within this window
|
|
449
|
+
"Allows clients to safely retry refresh requests within this window; "
|
|
450
|
+
"a rotated refresh token replayed within it is rejected without "
|
|
451
|
+
"triggering reuse detection (session revoke + account deactivation).",
|
|
450
452
|
)
|
|
451
453
|
|
|
452
454
|
# Quota consumption idempotency
|
{identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/src/identity_plan_kit/shared/constants.py
RENAMED
|
@@ -132,7 +132,7 @@ DEFAULT_ACCESS_TOKEN_EXPIRE_MINUTES = 15
|
|
|
132
132
|
DEFAULT_REFRESH_TOKEN_EXPIRE_DAYS = 7
|
|
133
133
|
|
|
134
134
|
# Token refresh idempotency TTL in seconds
|
|
135
|
-
DEFAULT_TOKEN_REFRESH_IDEMPOTENCY_TTL_SECONDS =
|
|
135
|
+
DEFAULT_TOKEN_REFRESH_IDEMPOTENCY_TTL_SECONDS = 300
|
|
136
136
|
|
|
137
137
|
# Quota idempotency TTL in seconds
|
|
138
138
|
DEFAULT_QUOTA_IDEMPOTENCY_TTL_SECONDS = 60
|
{identity_plan_kit-1.0.3 → identity_plan_kit-1.2.0}/tests/auth/test_oauth_service_resilience.py
RENAMED
|
@@ -196,14 +196,14 @@ class TestRetryableExceptions:
|
|
|
196
196
|
|
|
197
197
|
def test_network_errors_are_retryable(self):
|
|
198
198
|
"""Network-related exceptions should be retryable."""
|
|
199
|
-
import
|
|
199
|
+
import httpx2
|
|
200
200
|
|
|
201
201
|
expected_retryable = {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
httpx2.ConnectError,
|
|
203
|
+
httpx2.ConnectTimeout,
|
|
204
|
+
httpx2.ReadTimeout,
|
|
205
|
+
httpx2.WriteTimeout,
|
|
206
|
+
httpx2.PoolTimeout,
|
|
207
207
|
OSError,
|
|
208
208
|
ConnectionError,
|
|
209
209
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""SQLAdmin role gating against a real admin app.
|
|
2
|
+
|
|
3
|
+
Superadmin (env credentials) gets create/edit/delete; DB admins are view-only.
|
|
4
|
+
Button visibility and the write routes both come from
|
|
5
|
+
``BaseAdminView.has_permission`` — no template overrides involved.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from collections.abc import AsyncGenerator
|
|
9
|
+
from http import HTTPStatus
|
|
10
|
+
from typing import Any
|
|
11
|
+
from uuid import uuid4
|
|
12
|
+
|
|
13
|
+
import pytest
|
|
14
|
+
from fastapi import FastAPI
|
|
15
|
+
from httpx2 import ASGITransport, AsyncClient
|
|
16
|
+
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker
|
|
17
|
+
|
|
18
|
+
from identity_plan_kit.admin.auth import AdminAuthBackend
|
|
19
|
+
from identity_plan_kit.admin.views import RoleAdmin, setup_admin
|
|
20
|
+
from identity_plan_kit.rbac.models.role import RoleModel
|
|
21
|
+
|
|
22
|
+
SUPERADMIN_EMAIL = "root@example.com"
|
|
23
|
+
SUPERADMIN_PASSWORD = "root-password-123" # noqa: S105
|
|
24
|
+
DB_ADMIN_EMAIL = "viewer@example.com"
|
|
25
|
+
DB_ADMIN_PASSWORD = "viewer-password-123" # noqa: S105
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.fixture
|
|
29
|
+
async def role(session_factory: async_sessionmaker[AsyncSession]) -> RoleModel:
|
|
30
|
+
async with session_factory() as session:
|
|
31
|
+
role = RoleModel(code=f"perm_test_{uuid4().hex[:8]}", name="Admin Perm Test")
|
|
32
|
+
session.add(role)
|
|
33
|
+
await session.commit()
|
|
34
|
+
return role
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@pytest.fixture
|
|
38
|
+
def role_id(role: RoleModel) -> str:
|
|
39
|
+
return str(role.id)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@pytest.fixture
|
|
43
|
+
async def admin_client(
|
|
44
|
+
db_engine: AsyncEngine,
|
|
45
|
+
session_factory: async_sessionmaker[AsyncSession],
|
|
46
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
47
|
+
) -> AsyncGenerator[AsyncClient, None]:
|
|
48
|
+
backend = AdminAuthBackend(
|
|
49
|
+
secret_key="s" * 32,
|
|
50
|
+
admin_email=SUPERADMIN_EMAIL,
|
|
51
|
+
admin_password=SUPERADMIN_PASSWORD,
|
|
52
|
+
session_factory=session_factory,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# DB-admin lookup is covered elsewhere; here we only need a session that
|
|
56
|
+
# carries the view-only "admin" role.
|
|
57
|
+
async def _fake_db_admin(_self: Any, email: str, password: str) -> bool:
|
|
58
|
+
return email == DB_ADMIN_EMAIL and password == DB_ADMIN_PASSWORD
|
|
59
|
+
|
|
60
|
+
monkeypatch.setattr(AdminAuthBackend, "_authenticate_db_admin", _fake_db_admin)
|
|
61
|
+
|
|
62
|
+
app = FastAPI()
|
|
63
|
+
setup_admin(app, db_engine, authentication_backend=backend)
|
|
64
|
+
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
|
65
|
+
yield client
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def _login(client: AsyncClient, email: str, password: str) -> None:
|
|
69
|
+
resp = await client.post("/admin/login", data={"username": email, "password": password})
|
|
70
|
+
assert resp.status_code in (302, 303), resp.text
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
IDENTITY = RoleAdmin.identity
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class TestSuperadmin:
|
|
77
|
+
async def test_sees_and_reaches_write_actions(
|
|
78
|
+
self, admin_client: AsyncClient, role_id: str
|
|
79
|
+
) -> None:
|
|
80
|
+
await _login(admin_client, SUPERADMIN_EMAIL, SUPERADMIN_PASSWORD)
|
|
81
|
+
|
|
82
|
+
listing = await admin_client.get(f"/admin/{IDENTITY}/list")
|
|
83
|
+
assert listing.status_code == HTTPStatus.OK
|
|
84
|
+
assert f"/admin/{IDENTITY}/create" in listing.text
|
|
85
|
+
assert f"/admin/{IDENTITY}/edit/{role_id}" in listing.text
|
|
86
|
+
assert f"/admin/{IDENTITY}/delete" in listing.text
|
|
87
|
+
|
|
88
|
+
assert (await admin_client.get(f"/admin/{IDENTITY}/create")).status_code == HTTPStatus.OK
|
|
89
|
+
assert (
|
|
90
|
+
await admin_client.get(f"/admin/{IDENTITY}/edit/{role_id}")
|
|
91
|
+
).status_code == HTTPStatus.OK
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class TestDbAdminIsViewOnly:
|
|
95
|
+
async def test_can_list_and_view_details(
|
|
96
|
+
self, admin_client: AsyncClient, role: RoleModel, role_id: str
|
|
97
|
+
) -> None:
|
|
98
|
+
await _login(admin_client, DB_ADMIN_EMAIL, DB_ADMIN_PASSWORD)
|
|
99
|
+
|
|
100
|
+
listing = await admin_client.get(f"/admin/{IDENTITY}/list")
|
|
101
|
+
assert listing.status_code == HTTPStatus.OK
|
|
102
|
+
assert role.code in listing.text
|
|
103
|
+
|
|
104
|
+
details = await admin_client.get(f"/admin/{IDENTITY}/details/{role_id}")
|
|
105
|
+
assert details.status_code == HTTPStatus.OK
|
|
106
|
+
assert f"/admin/{IDENTITY}/edit/{role_id}" not in details.text
|
|
107
|
+
|
|
108
|
+
async def test_write_buttons_hidden(self, admin_client: AsyncClient, role_id: str) -> None:
|
|
109
|
+
await _login(admin_client, DB_ADMIN_EMAIL, DB_ADMIN_PASSWORD)
|
|
110
|
+
|
|
111
|
+
listing = await admin_client.get(f"/admin/{IDENTITY}/list")
|
|
112
|
+
assert f"/admin/{IDENTITY}/create" not in listing.text
|
|
113
|
+
assert f"/admin/{IDENTITY}/edit/{role_id}" not in listing.text
|
|
114
|
+
assert f"/admin/{IDENTITY}/delete" not in listing.text
|
|
115
|
+
|
|
116
|
+
async def test_write_routes_forbidden(self, admin_client: AsyncClient, role_id: str) -> None:
|
|
117
|
+
await _login(admin_client, DB_ADMIN_EMAIL, DB_ADMIN_PASSWORD)
|
|
118
|
+
|
|
119
|
+
assert (
|
|
120
|
+
await admin_client.get(f"/admin/{IDENTITY}/create")
|
|
121
|
+
).status_code == HTTPStatus.FORBIDDEN
|
|
122
|
+
assert (
|
|
123
|
+
await admin_client.get(f"/admin/{IDENTITY}/edit/{role_id}")
|
|
124
|
+
).status_code == HTTPStatus.FORBIDDEN
|
|
125
|
+
delete = await admin_client.delete(f"/admin/{IDENTITY}/delete", params={"pks": role_id})
|
|
126
|
+
assert delete.status_code == HTTPStatus.FORBIDDEN
|