User in group
User in group ( user ; group ) : Boolean
Parameter | Type | Description | |
---|---|---|---|
user | Text | → | User account name |
group | Text | → | Group name |
Function result | Boolean | ← | TRUE = user is in group FALSE = user is not in group |
This command is not thread-safe, it cannot be used in preemptive code.
Description
User in group returns TRUE if user is in group.
Note: This command expects a user account name in the user parameter (it does not support user aliases). If you have defined user aliases in your applicaton, pass the 4D user account parameter to the Current user command to make sure it returns a user account (see example).
Example
The following example searches for specific invoices. If the current user is in the Executive group, he or she is allowed access to forms that display confidential information. If the user is not in the Executive group, a different form is displayed:
QUERY([Invoices];[Invoices]Retail>100)
If(User in group(Current user(4D user account);"Executive"))
//4D user account parameter is necessary if you
//use 4D user aliases in your application
FORM SET OUTPUT([Invoices];"Executive Output")
FORM SET INPUT([Invoices];"Executive Input")
Else
FORM SET OUTPUT([Invoices];"Standard Output")
FORM SET INPUT([Invoices];"Standard Input")
End if
MODIFY SELECTION([Invoices];*)