- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 12:22 AM
Hi,
We know that g_user.hasRole('itil'); will return true if user has itil role or admin role. Similarly does, gs.hasRole('itil'); works the same or does it return true only when user has itil role.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 12:25 AM
Hi @Sachin G K1 both method works the same, the difference is
g_user.hasRole() // client side call
gs.hasRole() // server side call
you could also use gs.hasRoleExactly()// it will check for admins as well
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 12:25 AM
Hi @Sachin G K1 both method works the same, the difference is
g_user.hasRole() // client side call
gs.hasRole() // server side call
you could also use gs.hasRoleExactly()// it will check for admins as well
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 12:32 AM
Hi Harish,
Just to clarify, gs.hasRole('itil'), will this return true if user doesn't have itil role but has admin role. Am i correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 12:36 AM
You are correct. The statement gs.hasRole('itil'); will not return true even if the user has the admin role.
please mark helpful and accept solution if you get answer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 12:38 AM
Hi @Sachin G K1 yes, it will return true for admin
Harish