SetSecurity

You can use this function for Optiva Workflows and Copy Methods.

Purpose

The function SetSecurity is used to modify the security permissions of an Optiva object and provides either broader or more restricted access based on defined security values.

Syntax


long SetSecurity(string objSymbol, string objectKey, <datatype> objectSecurity, <datatype> groupSecurity, <datatype> roleSecurity)

Return Value

If the code is successful a value zero (0) is displayed.

Arguments

Part Description
objSymbol The object type or current object type of the data.
Note: Use empty quotation marks to indicate the current symbol of the workflow.
objkey The object key or the current object key of the data.
Note: Use empty quotation marks to indicate the current object of the workflow.
OwnerSecurity The datatype can be string/int. Set Owner security for the new object.
Note: Use empty quotation marks to leave owner security at its current value.
GroupSecurity The datatype can be string/int. Set Group security for the new object.
Note: Use empty quotation marks to leave group security at its current value.
RoleSecurity The datatype can be string/int. Set Role security for the new object.
Note: Use empty quotation marks to leave role security at its current value.

Use these security values to set OWNER/GROUP/ROLE Security:

  • 0 - No access
  • 3 - Read/Copy
  • 7 - Read/Copy/Write
  • 15 - Read/Copy/Write/Delete

Description

SetSecurity assigns new security values to an object. This function provides more or less access to an object. For example, if a formula is in a workflow for approval, set tighter security so that users cannot change the formula.

For a raw material item with a constituent formula, specify the security at the beginning of the script. This allows for updates for the items in the constituent formula.

Examples

For formulas and specifications, you must include a backslash (\) followed by a version number.

In this example, the security for ITEMCODE is owner privileges of 7 (read/copy/write), group privileges of 7 (read/copy/write), and role privileges of 1 (read).


Dim oItemkey As Object = ObjProperty("ITEMCODE")
Dim lSecurity As Long = SetSecurity("ITEM",oItemkey,7,7,1)

In the next example, only the security for group is changed. Use empty quotation marks ("") to keep the security that is currently defined:


Dim lSecurity As Long = SetSecurity("ITEM",oItemkey, "",7,"")
Example 1:
SetSecurity("ITEM", "ITEM1" , 7, 7, 0)
;

This example grants full access (7 = Read/Copy/Write) to the Owner, and read/copy access (7) to the Group, while denying access (0) to the Role for the item "ITEM1"

Example 2:
SetSecurity("FORMULA", FORMULA1, "", 7, "")
;

This example sets security permissions on the formula identified by the variable FORMULA1. It grants full access (7 = Read/Copy/Write) to the Owner, while leaving Group and Role security unchanged (empty strings mean no change).

Example 3:
SetSecurity("", "", 7, 3, 3)
;

This example grants full access (7 = Read/Copy/Write) to owner, read/copy access to Group and Role for current object on which workflow is launched.