Here is the code for the privileged routine example. Create the class using your IDE.
Write !, "Welcome to the Privileged App Routine"
Write !, "User before: ", $USERNAME
Write !, "Roles before: ", $ROLES
Write !, "User after: ", $USERNAME
Write !, "Roles after: ", $ROLES