Add a business rule to filter out hidden groups

This business rule filters out hidden groups. Only users within the hidden group and users marked admin or groups_admin can see the group.

Create a new "before query" business rule on the sys_user_group (Group) table with the following script:

if (!gs.hasRole("admin") && !gs.hasRole("groups_admin") && gs.getSession().isInteractive()) { 
  var qc = current.addQuery("u_hidden", "!=", "true"); //cannot see hidden groups... 
  qc.addOrCondition("sys_id", "javascript:getMyGroups()"); //...unless in the hidden group 
}