docs.intersystems.com
Home  /  Security Features of InterSystems IRIS  /  Security Tutorial  /  Code for Authorization Example


Security Tutorial
Code for Authorization Example
[Back]
InterSystems: The power behind what matters   
Search:  


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