How can I check if the current login user has specific roles and he is the manager of a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 03:14 AM
How can I make sure that only users with 'local_manager' role or user that is currently currently trying to edit the group members is the manager of that group will be able to edit?
I tried to user this advance acl both on write and create but its not working.
if (gs.hasRole('local_manager')) {
answer = true;
} else if (current.group.manager == gs.getUserID()) {
answer = true;
}
else {
answer = false;
}
I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 04:00 AM
Hi @Alon Grod ,
How many groups you have? You can use above code & check the member of the groups with OR conditions.
if (gs.getUser().hasRole('local_manager') && (gs.getUser().isMemberOf(gs.getProperty("Group"))) || (gs.getUser().isMemberOf(gs.getProperty("Group1")))) // Group is the sys_Property name
answer = true;
else
answer = false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 04:33 AM - edited ‎11-19-2023 09:11 AM
Hi Alon,
This post explains what needs to be done
https://servicenowguru.com/system-definition/group-managers-manage-group-members/