CheckSecurityLevel
- Last UpdatedOct 29, 2026
- 2 minute read
The function CheckSecurityLevel checks whether the current user has access to the specified security level.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
CheckSecurityLevel |
Security |
Synchronous |
Yes |
Supported |
Supported |
Supported |
Supported |
Supported |
Syntax
CheckSecurityLevel(numLevel,optNumType)
CheckSecurityLevel ( numLevel { | , { optNumType | 0 | 1 } } )
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 one of the following possible values:
|
Value |
Description |
|---|---|
|
-1 |
Invalid number of parameters. |
|
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 Creating and configuring groups.
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 (that is, 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.
Similarly, 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.