Previous section   Next section

Requires

Specifies a list of privileges a user or process must have to call this method.

Usage

To specify that this method should be restricted to users or processes that have the specified privileges, use the following syntax:
Method name(formal_spec) As returnclass [ Requires = privilegelist ] 
{    //implementation } 
Where privilegelist is either a single privilege or a comma-separated list of privileges, enclosed in quotation marks. Each privilege takes the form resource:permission, where permission is Use, Read, or Write.

Details

The user or process must have all of the privileges in the list of privileges in order to call the method. Calling the method without the specified privileges results in a <PROTECT> error.
If a method inherits the Requires keyword from a superclass, you can add to the list of required privileges by setting a new value for the keyword. You cannot remove required privileges in this manner.

Default

If you omit this keyword, no special privileges are required to call this method.

Example

ClassMethod UpdateTotalSales() [ Requires = "%DB_Sales: Read, %DB_MARKETING: Write" ]
{
   set newSales = ^["SALES"]Orders
   set totalSales = ^["MARKETING"]Orders
   set totalSales = totalSales + newSales
   set ^["MARKETING"]Orders = totalSales
}

See Also

Previous section   Next section