brockallen / BrockAllen.MembershipReboot

MembershipReboot is a user identity management and authentication library.
Other
743 stars 239 forks source link

No multitenant overload for IUserAccountRepository.GetByID #672

Closed jkonecki closed 7 years ago

jkonecki commented 7 years ago

There is no overload for IUserAccountRepository.GetByID() that takes string tenant as the first argument. That causes the problem is cases where multitenancy is implemented using separate databases for each tenant as the cross-database query is needed to find the account. Also, this enforces unique ids across all the tenants (that's a lesser issue).

Because of the above there is a number of methods in UserAccountService that are missing multitenant overloads as well, eg. SetPassword, ChangeEmailRequest.

That makes the multitenant feature hard to use in larger systems.

brockallen commented 7 years ago

That's because ids are/should be unique. If you're doing multi-tenancy by separate DBs, then you don't need the built-in multi-tenancy feature of MR, IMO.

jkonecki commented 7 years ago

So you're suggesting one has a separate instance or Service and Repository for each tenant? That will require a straightforward change to dependency injection configuration.

brockallen commented 7 years ago

That will require a straightforward change to dependency injection configuration.

Yea, this is a common way to achieve multi-tenancy. Just have the DI system dynamically inject the right store/repository to the right tenant DB.

jkonecki commented 7 years ago

That information could be useful on the multitenancy wiki page.