function getDynamicUgroups($group_id, $instances) { include_once 'www/project/admin/ugroup_utils.php'; $hash = md5(serialize($instances)); if (!isset($this->_dynamics_ugroups)) { $this->_dynamics_ugroups = array(); } if (!isset($this->_dynamics_ugroups[$hash])) { $this->_dynamics_ugroups[$hash] = ugroup_db_list_dynamic_ugroups_for_user($group_id, $instances, $this->id); } return $this->_dynamics_ugroups[$hash]; }
/** group users to be notified of artifact changes * groups are done with respect to ugroups and * their permissions on the artifact * @param user_id an array of user ids * return $user_sets array of arrays of user ids: * return $ugroup_sets array of arrays of ugroup_ids. * the $user_sets keys correspond to the $ugroup_sets keys i.e. * $ugroup_sets[x] are the ugroups that the users in $user_sets[x] * belong to */ function groupNotificationList($user_ids, &$user_sets, &$ugroup_sets) { $group_id = $this->ArtifactType->getGroupID(); $group_artifact_id = $this->ArtifactType->getID(); $user_sets = array(); $ugroup_sets = array(); //go through user_ids array: //for each user have a look at which ugroups he belongs foreach ($user_ids as $user_id) { $specific_ugroups = ugroup_db_list_tracker_ugroups_for_user($group_id, $group_artifact_id, $user_id); //echo "<br>specific_ugroups for $user_id = "; print_r($specific_ugroups); $dynamic_ugroups = ugroup_db_list_dynamic_ugroups_for_user($group_id, $group_artifact_id, $user_id); //echo "<br>dynamic_ugroups for $user_id = "; print_r($dynamic_ugroups); $all_ugroups = array_merge($dynamic_ugroups, $specific_ugroups); //echo "<br>all_ugroups for $user_id = "; print_r($all_ugroups); $found_gr = false; while (list($x, $ug) = each($ugroup_sets)) { $diff1 = array_diff($ug, $all_ugroups); $diff2 = array_diff($all_ugroups, $ug); if (empty($diff1) && empty($diff2)) { // we found the magic users that are part of exactly the same ugroups as this user $gr = $user_sets[$x]; $gr[] = $user_id; unset($user_sets[$x]); $user_sets[$x] = $gr; $found_gr = true; break; } } // if we didn't find users who have exactly the same permissions we have to add this user separately if (!$found_gr) { $user_sets[] = array($user_id); $ugroup_sets[] = $all_ugroups; } } }
function getDynamicUgroups($group_id, $instances) { $hash = md5(serialize($instances)); if (!isset($this->_dynamics_ugroups)) { $this->_dynamics_ugroups = array(); } if (!isset($this->_dynamics_ugroups[$hash])) { $this->_dynamics_ugroups[$hash] = ugroup_db_list_dynamic_ugroups_for_user($group_id, $instances, $this->id); } return $this->_dynamics_ugroups[$hash]; }