isMember of the Parent Group in a ACL

Dan119
Mega Contributor

i am trying to setup an ACL to allow members of the Parent Group the ability to READ work notes.  The Parent Group has many child groups.

I have been trying and already expelled many hours, which to me would be a simple to do.

1. The members of the parent group should see work notes on all tickets of which are assigned to their child groups.
2. The members of the assignment group on the ticket should see work notes.
3. Other child groups that are not listed as the Assignment Group on the ticket should NOT see work notes.

Please help, Thanks

ps. Members of the parent are not in any of the child groups.

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, I think all you need to do is push the group sys_id's into an array and then check to see if the logged in user has a relationship to one of them.

untested code and the syntax may be a bit wobbly but you could try something like this

var answer = false;
var myGroups = [];
var myUser = gs.getUserID();

myGroups.push(current.assignment_group.sys_id);
myGroups.push(current.assignment_group.parent.sys_id);

var recCheck = new GlideRecord('sys_user_grmember');
recCheck.addQuery('user', myUser);
recCheck.addQuery('group', 'IN', myGroups.toString());
reCheck.query();

if(recCheck.next()) {

answer = true;

}

return answer;

 

 

 

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, I think all you need to do is push the group sys_id's into an array and then check to see if the logged in user has a relationship to one of them.

untested code and the syntax may be a bit wobbly but you could try something like this

var answer = false;
var myGroups = [];
var myUser = gs.getUserID();

myGroups.push(current.assignment_group.sys_id);
myGroups.push(current.assignment_group.parent.sys_id);

var recCheck = new GlideRecord('sys_user_grmember');
recCheck.addQuery('user', myUser);
recCheck.addQuery('group', 'IN', myGroups.toString());
reCheck.query();

if(recCheck.next()) {

answer = true;

}

return answer;

 

 

 

Tony, the script worked.  I didn't at first, since I did a copy/paste I didn't analyze the coding. You misspelled the .query line. Once i fixed that line, it worked like a charm. you have reCheck, should have been recCheck.query().

Dan119
Mega Contributor

Thanks, I'm to fix the wobble.  At least I have something to go on.  Thanks again. Will advise once I get the wobble unwobbled.