Switch Access Group dynamically
There are posted in the community that described how to switch access group dynamically.
Switch Access group for Rest API | Support Center (pega.com)
How to switch access group when authenticating ? | Support Center (pega.com)
The post suggested to use Pega Private Engine API to do so. Other similar posts also suggested the similar solution. The solution works as expected. However, The concern is the use of the private engine API (in bold) to accomplish this requirement.
try { PRThread prtRef = tools.getThread(); if (prtRef != null) { ((com.pega.pegarules.priv.authorization.PegaAuthorization)prtRef.getAuthorization()).replaceAccessGroup(prtRef, AccessGroup); } } catch (Exception ilEx) { oLog.error("Error", ilEx); tools.putParamValue("test",ilEx.toString() ); }
Questions:
1. Is it ok to use the Pega Private Engine API as showned above to switch access group when authenticating?
2. If this is not the correct way to switch access group dynamically, what is the correct way to do so?
3. Are there any OOTB API, activity, function, etc. that we can use to switch user access group dynamically?
Thanks