Example: Executing the Privileged Routine Application
After completing the steps described on the previous pages, we can test MyPrivilegedRoutineApplication. In this example, we execute the PrivRoutineExample routine twice with our user JSmith: once with JSmith as a member of %Developer only and once with JSmith a member of SecurityTutorialRole as well as %Developer.
In the first case, JSmith is a member of %Developer but not SecurityTutorialRole.
-
Verify that JSmith is a member of %Developer but not SecurityTutorialRole. See Adding a User to a Role for instructions.
-
Open Terminal by clicking the InterSystems Launcher in the System Tray.
-
If Terminal does not open in the USER Namespace, use the ZN command to change to the USER Namespace.
DOCBOOK>ZN "USER" USER>
-
Now use $SYSTEM.Security.Login to log in JSmith.
USER>Write $SYSTEM.Security.Login("JSmith","JSmith") 1
-
Now execute PrivRoutineExample.
USER>Do ^PrivRoutineExample Welcome to the Privileged App Routine User before: JSmith Roles before: %Developer User after: JSmith Roles after: %Developer
Note that the routine does not add JSmith to any roles. This is because JSmith is not a member of SecurityTutorialRole.
-
Close Terminal.
In the second case, JSmith is a member of both %Developer and SecurityTutorialRole.
-
Use the Management Portal to add JSmith to SecurityTutorialRole. See Adding a User to a Role for instructions.
-
Open Terminal. Change to the USER namespace, if necessary.
-
Use $SYSTEM.Security.Login to log in JSmith.
-
Now execute PrivRoutineExample again.
USER>Do ^PrivRoutineExample Welcome to the Privileged App Routine User before: JSmith Roles before: %Developer,SecurityTutorialRole User after: JSmith Roles after: %Developer,PrivRoutineRole,SecurityTutorialRole
This time the routine adds JSmith to PrivRoutineRole.