abp icon indicating copy to clipboard operation
abp copied to clipboard

AppUser and UserManager/UserRepository

Open bluprints-todd opened this issue 5 years ago • 1 comments

Hi,

I started a new project using the Blazor template. I love the framework and the documentation which definitely helps getting started.

Right now, I am having an issue with extending the AppUser object out of the box. I followed the directions on adding a new property/table column (https://docs.abp.io/en/abp/latest/Module-Entity-Extensions#quick-example) but am having trouble using the new properties in certain scenarios.

So let's assume I have followed the guide and added a SocialSecurityNumber property on my AppUser class. How would I do the following:

  • How to add a navigation property on AppUser, for example, Roles?
  • How to use my new property when working with the IdentityUserManager? For example, IdentityUserManager.FindByEmailAsync which returns an IdentityUser (not AppUser). Would I need to work with both objects simultaneously when I need to work with my new properties?
  • Is it possible to inherit AppUser from IdentityUser? Now I cannot use IdentityUser props/methods like "Roles", or "IsInRole", etc. when I have an AppUser instance.
  • How to add new claims in the AbpUserClaimsPrincipalFactory.CreateAsync using the AppUser? The AbpUserClaimsPrincipalFactory class uses the IdentityUser (not AppUser). Should I query the database for an AppUser during the creation?

Any guidance would be appreciated.

Thanks

bluprints-todd avatar Feb 25 '21 04:02 bluprints-todd

hi @bluprints-todd

The answers to these questions can be found in the document(https://docs.abp.io) and GitHub issues(https://github.com/abpframework/abp/issues), please try searching.

maliming avatar Feb 25 '21 05:02 maliming