Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

GetPrivEx

  • Last UpdatedJul 18, 2023
  • 2 minute read

Checks if the current user has the required privilege for a specified area and a specified piece of equipment.

If you have specific additional security requirements per equipment, you can set the default '_CALLBACK_EquipmentSecurity' label to a custom function of your own so that it will be called in addition to the default security check. The current default function is "DefaultEquipmentSecurityCallback".

The '_CALLBACK_EquipmentSecurity' label is set by default in the SA_Style1_MultiRes starter project. To view go to Standards | Labels.

Note: The default callback function does not use the sOperation or sArg fields.

Syntax

GetPrivEx(INT nPriv, INT nArea [, STRING sEquipment [, STRING sOperation [, STRING sArg]]])

nPriv

The privilege level - 0 to 8.

nArea

The area of privilege - 0 to 255.

sEquipment

Equipment reference in which you are interested. It does not need to be in the same area. This is an optional parameter.

sOperation

The reason for privilege request. This is an optional parameter.

sArg

Custom argument to be passed to callback function, which is defined by its caller. This is an optional parameter.

Return Value

Returns 1 if the user has the specified privilege in the area, or 0 (zero) if the user does not have the privilege.

Example

Example below outlines using a custom function to determine if the user can bypass or removebypass when working with interlocks.

// Extended callback that supports interlocks context

GLOBAL STRING g_sInterlockBypassOperation = "Interlock.Bypass"; // Interlock Bypass Operation

GLOBAL STRING g_sInterlockRemoveBypassOperation = "Interlock.RemoveBypass"; // Interlock Remove Bypass Operation

PUBLIC

INT

FUNCTION CustomSecurityCallback(INT nPriv, INT nArea, STRING sEquipment, STRING sOperation, STRING sArg)

STRING sCategory;

STRING sInterlockingItem;

INT nResult = 1;

sCategory = Interlocks_GetSecurityCallbackCategory(sArg);

SinterlockingItem = Interlocks_GetSecurityCallbackReferencedItem(sArg);

TraceMsg("Interlocks CustomSecurityCallback: " + sEquipment + "/" + sArg + "/" + sOperation + "/" + sCategory + "/" + sInterlockingItem);

IF (sOperation = g_sInterlockBypassOperation) THEN

TraceMsg(sInterlockingItem + " in interlock category " + sCategory + " is being bypassed for " + sEquipment);

// Don't allow bypass for 'GuestEngineer'

IF Name() = "GuestEngineer" THEN

nResult = 0;

END

ELSE

IF (sOperation = g_sInterlockRemoveBypassOperation) THEN

TraceMsg(sInterlockingItem + " in interlock category " + sCategory + " is removing bypass for " + sEquipment);

// Don't allow removebypass for 'GuestManager'

IF Name() = "GuestManager" THEN

nResult = 0;

END

END

END

RETURN nResult;

END

See Also

Public Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in