6.3 Use Case: Simulating User Sessions
The example presented here will provide administrative users the ability to simulate different user sessions without explicitly logging in as that user. To login as a user, see Emulating a User Login in Administration Reference.
The administrator would login to the InetSoft server, and access a custom JSP page which sets custom properties on the SRPrincipal object. See Accessing the SRPrincipal Object for more details.
inetsoft.sree.security.SRPrincipal p =
(inetsoft.sree.security.SRPrincipal)session.getAttribute
(inetsoft.sree.RepletRepository.PRINCIPAL_COOKIE);
// setting a custom property
p.setProperty("sim_user", "david");
These custom properties can be accessed within the script of a VPM and used to set a user/role based filtering parameter defined in the 'Conditions' tab of the VPM.
VPM Lookup Trigger:
var p = parameter['__principal__'];
if(!isNull(p)) {
parameter['usr'] = p.getProperty("sim_user");
}
Note that parameter['usr'] would be a parameter defined in a clause of the VPM filtering conditions (in the Conditions tab), for example:
sales_employees.first_name [is] [equal to] $(usr)
Reserved parameters such as $(_USER_) or $(_ROLES_) cannot be modified (set) in VPM script and should not be used directly in VPM filtering conditions.
| << 6.2.2 setParameter() | © 1996-2013 InetSoft Technology Corporation (v11.4) | Appendix A: Changing the Name of the 'Sree' Web Application >> |