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:
- If a user is connected via a DMZ server, the ServerObject.CheckAccess function will return false for permissions that require write access to the system (see De-Militarized Zone (DMZ) Permanent Standby Servers in the ClearSCADA Guide to Server Administration)
- If database items are under the Exclusive Control of another user, the ServerObject.CheckAccess function will return false for permissions if the features associated with those permissions are reserved for the user with exclusive control. This is because the currently logged on user will not have access to those features while they are under the Exclusive Control of the other user (see Exclusive Control in the ClearSCADA Guide to Security).
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:
For more information on the various permissions, see Allocating Security Permissions in the ClearSCADA 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".