JonPSmith / AuthPermissions.AspNetCore

This library provides extra authorization and multi-tenant features to an ASP.NET Core application.
https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/
MIT License
764 stars 155 forks source link

Invoke app-defined ITenantChangeService from BulkLoadTenantsService.AddTenantsToDatabaseAsync #45

Closed Code420SW closed 2 years ago

Code420SW commented 2 years ago

The app-defined ITenantChangeService is not invoked during the bulk-loading process (from BulkLoadTenantsService.AddTenantsToDatabaseAsync). This leaves the app-specific database (CompanyTenant in Example 3) in an inconsistent state after new tenants are added via the API.

This may be by-design for reasons I don't fully understand. If so, please close this issue. Otherwise, I am happy to pull a PR to address this issue.

JonPSmith commented 2 years ago

Hi @Code420SW,

The bulk load is only designed to set up the examples in this repo so that a developer can run an example and it will look like a fully production application. It bypasses a number of things, like ITenantChangeService and doesn't support some things, like sharding.

Therefore Bulk Load shouldn't be used in an production application, apart from one thing: setting a user on first deployment of a production application. The Bulk Load admin document didn't make that clear that is the only usage in production so I have updated that document page.

PS. Thanks for asking before creating a PR.