Code for Authorization Example
Here is the code for the authentication example. Create the class using Atelier.
Class SecurityTutorial.AuthorizationExample { ClassMethod CreateTestData() { Set ^TestData = "MyInitialData" } ClassMethod HelloUser() { Write "User ", $Username } ClassMethod UpdateTestData() { Set ^TestData = "MyUpdatedData" } ClassMethod ReadTestData() As %String { Return ^TestData } ClassMethod ProtectedMethod() As %String { If ($System.Security.Check("ProtectedMethod","U")) { Return $Username } Else { Return "Error: Insufficient Privileges" } } }
Note:
For more information about Atelier, including instructions for downloading and installing, as well as videos and tutorials on how to use it, see Atelier Download