docs.intersystems.com
Home / 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


[Back]          
  |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-04-10 14:45:57