TestUserInGroup - method of the Pm object
Description:
Test whether the user is or isn't a member of the user group.
Syntax:
Boolean TestUserInGroup(Long nType, String sGroups, [String sUserId])
Parameters:
nType | (Long) Type of the tested user
0 - as a user the local user is used
1 - as a user the value of the sUserId parameter is used |
sGroups | (String) User groups identifiers list (separated with comma ',') where the user is searched. |
sUserId | [optional] (String) Identifier of the local or network user |
---|
Return value:
true - the user is a member of any listed group
false - the user isn't a member of any listed group
Note:
If the designer creates a permissions system in the application based on logical user groups, then this method allows to test in the script if the logged-in (or else) user is a member of the group.
This method
is not functional in
Web panels. Instead of this, it is possible to use the following in the
Web panel:
- Call the designer's method of the
PmaPanel object (see the "
Methods" tab). The user information is not available directly from the client in the
Web panel. Calling this method initiates communication with the server, the method is executed on the server, and via the
pContext.User parameter it finds and returns the requested information. Calling this method returns the requested information after communication with the server.
Example:
Test whether the local user is a member of the
$OPER or
$ADMIN group
JavaScriptVBScriptSelect and copy to clipboard
if (Pm.TestUserInGroup(0, "$OPER,$ADMIN"))
{
// ...
}
If Pm.TestUserInGroup(0, "$OPER,$ADMIN") Then
' ...
End If