CAD · Question #205
Which method call returns true only if the currently logged in user has the catalog_admin role and in no other case?
The correct answer is B. g_user.hasRoleExactly(`catalog_admin'). The method call that returns true only if the currently logged in user has the catalog_admin role and in no other case is g_user.hasRoleExactly(`catalog_admin'). This method checks if the user has exactly one role, and returns true if it matches the argument. The other methods re
Question
Which method call returns true only if the currently logged in user has the catalog_admin role and in no other case?
Options
- Ag_user.hasRole(`catalog_admin')
- Bg_user.hasRoleExactly(`catalog_admin')
- Cg_user.hasRoleOnly(`catalog_admin')
- Dg_user.hasRoleFromList(`catalog_admin')
How the community answered
(29 responses)- A3% (1)
- B93% (27)
- C3% (1)
Explanation
The method call that returns true only if the currently logged in user has the catalog_admin role and in no other case is g_user.hasRoleExactly(`catalog_admin'). This method checks if the user has exactly one role, and returns true if it matches the argument. The other methods return true if the user has one or more roles, or if the user has any role from a list of arguments.
Topics
Community Discussion
No community discussion yet for this question.