Which code path checks for the admin role in a server-side script?

Prepare effectively for the ServiceNow CAD certification. Study with detailed questions and explanations. Enhance your skills and knowledge for success in your exam!

Multiple Choice

Which code path checks for the admin role in a server-side script?

Explanation:
When you want to know if the current user has the admin role on the server side, use the function that checks role membership by name. gs.hasRole('admin') looks at the user’s assigned roles and returns true if the admin role is included, making it the right way to guard server-side logic that should only run for admins. The other options target different concepts: hasPrivilege checks a specific privilege (a more granular permission) rather than a role, and the other two options aren’t standard ways to verify a user’s role on the server side.

When you want to know if the current user has the admin role on the server side, use the function that checks role membership by name. gs.hasRole('admin') looks at the user’s assigned roles and returns true if the admin role is included, making it the right way to guard server-side logic that should only run for admins.

The other options target different concepts: hasPrivilege checks a specific privilege (a more granular permission) rather than a role, and the other two options aren’t standard ways to verify a user’s role on the server side.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy