For the role pa_admin, which method should be used to exclusively check if admins have the specified role?

Prepare for the ServiceNow CAD Exam with comprehensive flashcards and multiple-choice questions. Each query offers hints and explanations. Ensure your success on the exam!

Multiple Choice

For the role pa_admin, which method should be used to exclusively check if admins have the specified role?

Explanation:
The feature being tested is choosing a method that confirms exclusivity of a role for the current user. To ensure a user has exactly the specified role and no others, you use the exact-role check on the g_user object. g_user.hasRoleExactly('pa_admin') returns true only when the user’s role list is precisely pa_admin and contains no additional roles. This is what “exclusively check” demands. Using g_user.hasRole('pa_admin') would return true even if the user has pa_admin plus other roles, so it isn’t exclusive. The other option names aren’t the correct or standard API for this check on the client side, and gs_user isn’t the proper global object for role checks.

The feature being tested is choosing a method that confirms exclusivity of a role for the current user. To ensure a user has exactly the specified role and no others, you use the exact-role check on the g_user object. g_user.hasRoleExactly('pa_admin') returns true only when the user’s role list is precisely pa_admin and contains no additional roles. This is what “exclusively check” demands.

Using g_user.hasRole('pa_admin') would return true even if the user has pa_admin plus other roles, so it isn’t exclusive. The other option names aren’t the correct or standard API for this check on the client side, and gs_user isn’t the proper global object for role checks.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy