Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Power Tools and UserId #12259


User avatar
0
qquestel created

I am creating an entity using Power Tools. How do i capture the current Logged In user 'Id' and 'TennentId' to update the fields the the database for that table


3 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi

    You can use the AbpSession extension to get the information of the logged in user. You can get it by calling AbpSession.GetTenantId(), AbpSession.GetUserId() methods. If you want to get UserIdentifier as well. You can use it as AbpSession.ToUserIdentifier().

  • User Avatar
    0
    qquestel created

    Hi

    You can use the AbpSession extension to get the information of the logged in user. You can get it by calling AbpSession.GetTenantId(), AbpSession.GetUserId() methods. If you want to get UserIdentifier as well. You can use it as AbpSession.ToUserIdentifier().

    So you cant get it from Add New Navigation Property in Power Tools?

    Select Your Entity Like User (x.x.Authorization.Users.long ?

    I would have to create the Property in PowerTool and then update it in code to use AbpSession.GetUserId()

  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi

    Yes, when creating the relevant entity, you can filter by user by associating the User in the Navigation Property with the user you selected, as you said, you will need to update it manually. Here, you can condition it by taking the logged in user instead of the user information in the input.