Implement activation checks across various commands and queries
CI / Backend (build + test) (push) Successful in 1m26s
CI / Frontend (lint + typecheck + build) (push) Successful in 30s

- Introduced `IRequiresActivation` interface to enforce activation requirements for multiple commands and queries, ensuring that only activated users can create, edit, or access configurations, news, and applications.
- Updated the `RequireActivationBehavior` to handle activation checks uniformly, returning appropriate errors for unauthenticated or inactive users.
- Enhanced error handling by adding `NotActivated` error to provide clear feedback for users attempting to access restricted features.
- Updated documentation to reflect the new activation requirements and their implications on user access and functionality.
This commit is contained in:
Leonid Pershin
2026-07-13 18:51:03 +03:00
parent 7f9a441050
commit 14b64a3140
23 changed files with 183 additions and 45 deletions
@@ -22,9 +22,10 @@ public static class DependencyInjection
RegisterClosedGeneric(services, assembly, typeof(IQueryHandler<,>));
RegisterClosedGeneric(services, assembly, typeof(IValidator<>));
// Порядок важен: Logging (снаружи) -> Validation -> UnitOfWork (ближе к хендлеру).
// Порядок важен: Logging (снаружи) -> Validation -> RequireActivation -> UnitOfWork (ближе к хендлеру).
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(RequireActivationBehavior<,>));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(UnitOfWorkBehavior<,>));
return services;