ExamGecko
Question list
Search
Search

Question 29 - CAD discussion

Report
Export

In a Business Rule, which one of the following returns true if the currently logged in user has the admin role?

A.
g_form.hasRoleExactly('admin')
Answers
A.
g_form.hasRoleExactly('admin')
B.
gs.hasRole('admin')
Answers
B.
gs.hasRole('admin')
C.
g_form.hasRole('admin')
Answers
C.
g_form.hasRole('admin')
D.
gs.hasRoleExactly('admin')
Answers
D.
gs.hasRoleExactly('admin')
Suggested answer: B

Explanation:

Business Rule is server-side, so it uses GlideSystem API. gs.hasRoleExactly doesn't exist

In a Business Rule, the following returns true if the currently logged in user has the admin role:

gs.hasRole('admin'). This is the correct answer because gs is the GlideSystem object, which provides methods for performing system operations, and hasRole is a method that checks if the current user has the specified role. For example, gs.hasRole('admin') will return true if the current user has the admin role, and false otherwise.

The following do not return true if the currently logged in user has the admin role in a Business Rule:

g_form.hasRoleExactly('admin'). This is not correct because g_form is the GlideForm object, which provides methods for manipulating forms, and hasRoleExactly is a method that checks if the current user has exactly the specified role and no other roles. For example, g_form.hasRoleExactly('admin') will return true if the current user has only the admin role, and false if the current user has the admin role and any other role.

g_form.hasRole('admin'). This is not correct because g_form is the GlideForm object, which provides methods for manipulating forms, and hasRole is a method that checks if the current user has the specified role or any role that contains the specified role. For example, g_form.hasRole('admin') will return true if the current user has the admin role or any role that contains the admin role, such as admin_ui or admin_script.

gs.hasRoleExactly('admin'). This is not correct because gs is the GlideSystem object, which provides methods for performing system operations, and hasRoleExactly is not a valid method of the gs object. There is no method that checks if the current user has exactly the specified role and no other roles in the gs object.References:Business Rules, GlideSystem, GlideForm

asked 23/09/2024
Emma Buchanan
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first