CheckSecurityLevel

The function CheckSecurityLevel checks whether the current user has access to the specified security level.

Function Group Execution Windows Embedded Thin Client Mobile Access
CheckSecurityLevel Security Synchronous Supported Supported Supported Supported

Syntax

  CheckSecurityLevel(numLevel,optNumType)  
Web Studio Help security checksecuritylevel.xml d419386e102 CheckSecurityLevel
numLevel
The security level to be checked.
optNumType
The type of security level to check: 0 is Runtime, 1 is Development.

This is an optional parameter; if no value is specified, the default value is 0.

Returned value

This function returns the following possible values:
Value Description
0 The current user does not have access to the specified security level.
1 The current user has access to the specified security level.

Notes

Each user can belong to multiple groups, and those groups typically have access to different security levels. Rather than check the groups to which a user belongs, and from that try to determine the security levels to which the user has access, you can use this function to check the security levels directly.

For more information about groups and security levels, see Group Account dialog.

Examples

The user “Bob” belongs to the groups “GroupA” and “GroupB”. GroupA has access to runtime levels 10 to 20, and GroupB has access to development levels 30 to 40. That means Bob has access to runtime security levels 10 to 20 and development security levels 30 to 40.

Given this, if Bob is the current user (i.e., the user who is currently logged onto the client where the function is executed) and this function is called to check for access to runtime security level 17…
  CheckSecurityLevel(17)  

…it returns a value of 1, meaning that Bob has access.

Similary, if this function is called to check for access to development security level 33…
  CheckSecurityLevel(33,1)  

…it again returns a value of 1.

However, if this function is called to check for access to runtime security level 25…
  CheckSecurityLevel(25,0)  

…it returns a value of 0, meaning that Bob does not have access.

CheckSecurityLevel