Example #1
0
 /**
  * getTrackerList - returns an array of Tracker that belongs to the project identified by group_id
  *
  * @param string $sessionKey the session hash associated with the session opened by the person who calls the service
  * @param int $group_id the ID of the group we want to retrieve the list of trackers
  * @return array the array of SOAPTracker that belongs to the project identified by $group_id, or a soap fault if group_id does not match with a valid project.
  */
 function getTrackerList($sessionKey, $group_id)
 {
     if (session_continue($sessionKey)) {
         $pm = ProjectManager::instance();
         try {
             $project = $pm->getGroupByIdForSoap($group_id, 'getTrackerList');
         } catch (SoapFault $e) {
             return $e;
         }
         if (!$project->usesService('plugin_tracker')) {
             return new SoapFault(get_service_fault, 'Tracker service is not used for this project.', 'getTrackerList');
         }
         $tf = TrackerFactory::instance();
         if (!$tf) {
             return new SoapFault(get_tracker_factory_fault, 'Could Not Get TrackerFactory', 'getTrackerList');
         }
         // The function getTrackersByGroupId returns all trackers,
         // even those the user is NOT allowed to view -> we will filter in trackerlist_to_soap
         $trackers = $tf->getTrackersByGroupId($group_id);
         return trackerlist_to_soap($trackers);
     } else {
         return new SoapFault(invalid_session_fault, 'Invalid Session', 'getTrackerList');
     }
 }
Example #2
0
 /**
  * getTrackerList - returns an array of TrackerDesc (short description of trackers) that belongs to the project identified by group_id
  *
  * @param string $sessionKey the session hash associated with the session opened by the person who calls the service
  * @param int $group_id the ID of the group we want to retrieve the list of trackers
  * @return array the array of SOAPTrackerDesc that belongs to the project identified by $group_id, or a soap fault if group_id does not match with a valid project.
  */
 function getTrackerList($sessionKey, $group_id)
 {
     if (session_continue($sessionKey)) {
         try {
             $pm = ProjectManager::instance();
             $group = $pm->getGroupByIdForSoap($group_id, 'getTrackerList');
         } catch (SoapFault $e) {
             return $e;
         }
         $project = new Project($group_id);
         if (!$project->usesService('tracker')) {
             return new SoapFault(get_service_fault, 'Tracker service is not used for this project.', 'getTrackerList');
         }
         $atf = new ArtifactTypeFactory($group);
         if (!$atf || !is_object($atf)) {
             return new SoapFault(get_artifact_type_factory_fault, 'Could Not Get ArtifactTypeFactory', 'getTrackerList');
         } elseif ($atf->isError()) {
             return new SoapFault(get_artifact_type_factory_fault, $atf->getErrorMessage(), 'getTrackerList');
         }
         // The function getArtifactTypes returns only the trackers the user is allowed to view
         return trackerlist_to_soap($atf->getArtifactTypes());
     } else {
         return new SoapFault(invalid_session_fault, 'Invalid Session', 'getTrackerList');
     }
 }