(new in 15.0)
The getuserattr() command writes the value of the requested attribute of a user object into a variable to be named.
The user account can be viewed in the Users.
Structure of the command
getuserattr('attribute_name','variable_name');
Return value
positive |
If the attribute could be found, has a valid value and can be stored to the variable. |
negative |
If the user is not authenticated, the attribute does not exist or the value of the attribute is empty. |
Parameters
attribute_name
The possible attribute names and the meaning of the values can be seen in the table of setuserattr()
variable_name
Name of the variable the value should be written to.
Example
Line |
Code |
|---|---|
01 |
if ( getuserattr('accountOptions', 'accOpts') ) { |
02 |
if (!compareattr('accOpts','equal','5')) { |
03 |
drop(502, 'expected accountOptions to be 5'); |
04 |
} |
05 |
} |
Explanation
In this example, getuserattr() tries to get the value of the users attribute accountOptions and to write this value into variable accOpts (line 1).
Only if this operation is successful, a comparison is made (line 02) whether the value written to variable accOpts equals "5", which means the user may not sign and may not encrypt (see table of setuserattr()). If the value is not 5 (note the ! before command compareattr()), the message will be dropped with the SMTP Code "502, expected accountOptions to be 5" (line 3).