0
chofoza created
- ABP Framework version: v4.1.0
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Seperated (Angular): no
Hi, I feel like this is an easy one...
I have a new property (bool Active) on the User object, stored in ExtraProperties. I want to reference it on the razor page, but the CurrentUser (ICurrentUser) object doesn't have it or ExtraProperties. How can I read the value?
In my example basically I want to do:
@if (CurrentUser.IsAuthenticated && CurrentUser.ExtraProperties["Active"])
2 Answer(s)
-
0
hi
- You can use UserManager in razor page to get user's Active . https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs#L15
- You can also add this value into the cliams.https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs#L29
-
0
Thank you, it worked. I had tried to use the UserManager but obviously was too lazy to find its namespace so wasted a question instead!
Thanks for your help.