0
bozkan created
- ABP Framework version: v4.4.3
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
We have a requirement to prevent assigning a user to multiple OU's. A user should only be a member of single group. Is there a way to achieve this?
1 Answer(s)
-
1
Hi @bozkan, you can override the AddToOrganizationUnitAsync method of
IdentityUserManager
class and inside of the method simply check the user is in any organization unit or not.- You can implement something similar with the following code.
public async override Task AddToOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou) { if (user.OrganizationUnits.Any()) { return; } base.AddToOrganizationUnitAsync(user, ou); }
- To overriding
IdentityUserManager
, see https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services#example-overriding-a-domain-service.