function &getGroups($session_ser, $group_ids) { global $feedback; continue_session($session_ser); $inputArgs = $session_ser; for ($i = 0; $i < count($group_ids); $i++) { $inputArgs = $inputArgs . ':' . $group_ids[i]; } $grps =& group_get_objects($group_ids); if (!$grps) { return new soap_fault('2001', 'group', 'Could Not Get Groups by Id' . $inputArgs, $feedback); } return groups_to_soap($grps); }
// Set up this script to run as the site admin // $res = db_query("SELECT user_id FROM user_group WHERE admin_flags='A' AND group_id='1'"); if (!$res) { //echo db_error(); exit(1); } if (db_numrows($res) == 0) { // There are no Admins yet, aborting without failing //echo "SUCCESS\n"; exit(0); } $id = db_result($res, 0, 0); session_set_new($id); $res = db_query("SELECT group_id FROM groups WHERE status != 'P'"); $groups =& group_get_objects(util_result_column_to_array($res)); for ($g = 0; $g < count($groups); $g++) { //make group dirs $newdirlocation = $GLOBALS['sys_upload_dir'] . '/' . $groups[$g]->getUnixName(); $cmd = "/bin/mkdir {$newdirlocation}"; //echo "\n$cmd"; if (!is_dir($newdirlocation)) { exec($cmd, $out); } $frsps =& get_frs_packages($groups[$g]); //echo count($frsps); for ($p = 0; $p < count($frsps); $p++) { if (!is_object($frsps[$p])) { continue; } //make package dirs
/** * MSPGetProjects * Return the projects by user. * * @author Luis Hurtado luis@gforgegroup.com * @param session_hash User session * @return Groups User groups * @date 2005-01-19 * */ function &MSPGetProjects($session_hash) { if (!session_continue($session_hash)) { $array['success'] = false; $array['errormessage'] = 'Could Not Continue Session'; } $group_res = db_query("SELECT groups.group_id FROM groups NATURAL JOIN user_group WHERE user_id='" . user_getid() . "' AND project_flags='2'"); $group_ids =& util_result_column_to_array($group_res, 'group_id'); $groups =& group_get_objects($group_ids); return $groups; }
/** * getGroups - get an array of groups this user is a member of. * * @return array Array of groups. */ function &getGroups() { $sql = "SELECT group_id\n\t\t\tFROM user_group\n\t\t\tWHERE user_id='" . $this->getID() . "'"; $res = db_query($sql); $arr =& util_result_column_to_array($res, 0); return group_get_objects($arr); }
/** * getLinkedProjects - List of projects referencing that role * * Includes the home project (for roles that have one) * * @return array Array of Group objects */ public function getLinkedProjects() { $ids = array(); $hp = $this->getHomeProject(); if ($hp != NULL) { $ids[] = $hp->getID(); } $res = db_query_params('SELECT group_id FROM role_project_refs WHERE role_id=$1', array($this->getID())); if ($res) { while ($arr = db_fetch_array($res)) { $ids[] = $arr['group_id']; } } return group_get_objects(array_unique($ids)); }
function &group_get_objects_by_name($groupname_arr) { $sql = "SELECT group_id FROM groups WHERE unix_group_name IN ('" . implode($groupname_arr, '\',\'') . "')"; $res = db_query($sql); $arr =& util_result_column_to_array($res, 0); return group_get_objects($arr); }