Skip to main content

This documentation is for an older version of this product. See the latest version of this content.Opens in a new tab

Code for Authorization Example

Here is the code for the authentication example. Create the class using your IDE.


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"
    }
}

}
Purpose of this instance: Draft documentation
DocReleaseID: SupplyChain2023.1
Content loaded from:
/staging/learning/iris-doc/2023.1.x/doc/supply-chain/en-us/src/
/staging/learning/iris-doc/2023.1.x/doc/cache/en-us/src/
/staging/learning/iris-doc/2023.1.x/doc/ensemble/en-us/src/
/staging/learning/iris-doc/2023.1.x/doc/iris/en-us/src/
/staging/learning/iris-doc/2023.1.x/doc/security/en-us/src/
Excluded items: PAGE_bi, PAGE_deployment, PAGE_interoperability, PAGE_release
FeedbackOpens in a new tab