Checks if the specified user has the specified role.
Parameters
Name of the user for which role membership is being checked. Must be an existing user. If blank, will use the current user. The default value is ‘’.
Name of role to check for membership.
Optional parameters. Allowed keys are:
no_error_if_not_exists – If false will return an error if the provided input parameter role does not exist or is blank. If true then it will return false for output parameter has_role. Allowed values are:
true
false
The default value is ‘false’.
only_direct – If false will search recursively if the input parameter principal is a member of input parameter role. If true then input parameter principal must directly be a member of input parameter role. Allowed values are:
true
false
The default value is ‘false’.
The default value is an empty dict ( ).
Returns
A dict with the following entries–
Value of input parameter principal.
Input parameter role for which membership is being checked.
Indicates whether the specified user has membership in the specified target input parameter role. Allowed values are:
True – User has membership in the role.
False – User does not have membership in the role.
Additional information. Allowed keys are:
direct – true when principal is directly a member of the role. Allowed values are:
true
false
The default value is ‘false’.
The default value is an empty dict ( ).