Script Includes to Check Groups the User is in and for Custom Group Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2015 07:01 AM
I was wondering if someone could help me with a script includes that checks the groups the user is in and if the group has a custom field called u_allow_all (true/false) checked. It would pass in the current user, check what groups they're in, check if any of the groups have the u_allow_all flag checked and return true, otherwise return false.
Thanks,
Aryanos
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2015 08:44 AM
You should be able to use something like this in your script include to query the group membership table and check the 'Allow All' attribute from the group. Not sure where you want to call this from but I was just trying it from a background script and passing it gs.getUserID().
function checkGroups(usr){
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('user',usr);
grMember.query();
while (grMember.next()){
if (grMember.group.u_allow_all)
return true;
}
return false;
}
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2015 09:12 AM
Thanks David, I'm planning to call it in an ACL so hopefully that won't be an issue. I'll test it out and let you know how it goes.
Aryanos

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2015 09:39 AM
Yes, it should work from an ACL script.