ServerObject.CheckAccess

The ServerObject.CheckAccess function allows a script to check whether the currently logged on user has a specific permission for an item.

Be aware that the function may return false for a particular permission even if the current user's settings provide access to an object. For example:

Syntax

ServerObject.CheckAccess (Permission)

Description

Checks whether the currently logged on user has a specific permission for an item.

Arguments

Permission.

The permission is a string that represents one of the database item's access permissions. The required characters are:

  • RD—Read
  • BRS—Browse
  • CTL—Control
  • OVR—Override
  • ALM—Acknowledge Alarms
  • VWA—View Alarms
  • RMA—Remove Alarms
  • RDR—Manual Redirection
  • UNA—Unacknowledge Alarms
  • ARS—Assign Alarm Responsibility
  • NOT—Notes
  • RET—Retrieve Data
  • PRM—Promote
  • TUN—Tune Limits
  • AHS—Annotate Historic
  • MHS—Modify Historic
  • VHS—Validate Historic
  • DIS—Enable/Disable
  • DLM—Disable Alarms
  • DCT—Disable Control
  • OFS—Off/On Scan
  • SWL—Switch Line
  • DIA—Diagnostics
  • CAN—Cancel Request
  • EXC—Exclusive Control
  • MEC—Manage Exclusive Control
  • CFG—Configure
  • SEC—Security
  • ADM—Sys Admin

For more information on the various permissions, see Allocating Security Permissions in the Geo SCADA Expert Guide to Security.

Returns

Boolean.

True if the currently logged on user has the defined permission; False if the currently logged on user does not have the defined permission.

Example:

The following script is used to display a message box that contains a message. The message differs depending on whether the currently logged on user has the Override/Release permission for a point named 'Tank Level':

Set objLevelPoint = Server.FindObject("Tank Level")

If objLevelPoint.CheckAccess("OVR") = True Then

objLevelPoint.Interface.Override 50

Else

Msgbox ("User Does Not Have Override Permissions")

End If

Where:

  • objLevelPoint is the name of a variable that is used to store the ServerObject that is returned by the FindObject function.
  • "Tank Level" is the name of the database item that the FindObject function searches for.
  • If objLevelPoint.CheckAccess("OVR") instructs the script to check the value of the CheckAccess property of the ServerObject that is stored in the objLevelPoint variable. In this case, it checks for the "OVR" Override/Release permission.
  • If the currently logged on user has the "OVR" permission for the "Tank Level" database item, an Override of 50 is set for the objLevelPoint. This is achieved by accessing the Interface property for the ServerObject that is stored by the objLevelPoint variable.
  • If the currently logged on user does not have the "OVR" permission for the "Tank Level" database item, a message box is displayed containing the message "User Does Not Have Override Permissions".

Disclaimer

Geo SCADA Expert 2019