0
votes

I'm looking to extend the base Singleton "AccessInfo" to include additional information pertaining to the current user (such as roles.)

Is there a most favorable path to do this? I can see how to extend a Graph, Cache, but not seeing any documentation how to extend this area.

1

1 Answers

1
votes

Unfortunately due to the way it has been implemented, there is not a way to add fields to that DAC and have them populated on instantiation, and since it's not selected from the DB like a normal DAC, I do not think events would fire for it.

If you would like to access Roles related to the current Users, this should suffice.

PXSelect<UsersInRoles,
                      Where<UsersInRoles.userName, Equal<Current<AccessInfo.userName>>>>.Select(this /*Or Base if it's a Graph Extension*/);

As there will likely be multiple Roles per user, you will need to loop.

foreach (UsersInRoles role in PXSelect<UsersInRoles, Where<UsersInRoles.userName, Equal<Current<AccessInfo.userName>>>>.Select(this /*Or Base if it's a Graph Extension*/))
{
    //Some thing here
}