Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

Example Setup (cont.)

Here is the code for PrivRoutineExample:


 write !, "Welcome to the Privileged App Routine"
 write !, "User before: ", $USERNAME
 write !, "Roles before: ", $ROLES

 Set status=$SYSTEM.Security.AddRoles("MyPrivilegedRoutineApplication")

 write !, "User after: ", $USERNAME
 write !, "Roles after: ", $ROLES   
Copy code to clipboard

The code does the following:

  1. Writes the user's user name and roles when the user enters the routine.

  2. Uses $SYSTEM.Security.AddRoles to add the user to additional roles. Note that MyPrivilegedRoutineApplication is the name of the privileged routine application. It is not the name of any role. The user is added to roles listed as Application Roles for the privileged routine application.

  3. Writes the user's user name and roles again to show the changes in the roles.

FeedbackOpens in a new window