- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 02:37 AM
Hello All,
i have a script include in which i would like to add 3 groups in the condition but not sure how to do it .need some help.
The script is:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 04:15 AM
if (gs.getUser().hasRole('itil')) {
result += '^nameINEXT_FTS,EXT_FTS_NW,EXT_FTS_Storage';
}
else if(gs.getUser().hasRole('ABS_EXT_FTS')){
result += '^name!=EXT_FTS^name!=EXT_FTS_NW^name!=EXT_FTS_Storage';
}
return result + '^ORDERBYDESCu_order';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 03:23 AM
You are not specifying a very important detail: what should the query express: that the groups "selected" should be one of those 3 or that the groups "selected" should be none of those 3?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 03:57 AM
Well what i want to achieve is :people with Role ABS_EXT_FTS should be able to view the 3 groups.
ie
EXT_FTS
EXT_FTS_NW
EXT_FTS_Storage.
People with itil role should not be able to see these 3 groups.
The script include works for just one group.But as you can see i need to hide 3 groups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 04:15 AM
if (gs.getUser().hasRole('itil')) {
result += '^nameINEXT_FTS,EXT_FTS_NW,EXT_FTS_Storage';
}
else if(gs.getUser().hasRole('ABS_EXT_FTS')){
result += '^name!=EXT_FTS^name!=EXT_FTS_NW^name!=EXT_FTS_Storage';
}
return result + '^ORDERBYDESCu_order';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 03:25 AM - edited 11-24-2023 03:33 AM
It looks like you are intending to return an encoded query. When you are specifying that something is not equal to more than one thing, you must logically always join them with an AND - as using OR will always make the condition false because it's always not equal to one of those - so try changing your script to:
if (!gs.getUser().hasRole('ABS_EXT_FTS')) {
result += '^name!=EXT_FTS^name!=EXT_FTS_NW^name!=EXT_FTS_Storage';
}
return result + '^ORDERBYDESCu_order';