Esempio n. 1
0
 /**
  * getUploadedFiles - get the names of the files present in the incoming directory
  *
  * @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 add the file
  * @return array of string the names of the files present in the incoming directory, 
  *              or a soap fault if :
  *              - group_id does not match with a valid project, 
  *              - the user does not have the permissions to see the incoming directory (must be project admin, file admin or super user)
  */
 function getUploadedFiles($sessionKey, $group_id)
 {
     if (session_continue($sessionKey)) {
         try {
             $pm = ProjectManager::instance();
             $project = $pm->getGroupByIdForSoap($group_id, 'getUploadedFiles');
         } catch (SoapFault $e) {
             return $e;
         }
         $file_fact = new FRSFileFactory();
         if ($file_fact->userCanAdd($group_id)) {
             $soap_files = array();
             $file_names = $file_fact->getUploadedFileNames($project);
             return $file_names;
         } else {
             return new SoapFault(invalid_file_fault, 'User not allowed to see the uploaded files', 'getUploadedFiles');
         }
     } else {
         return new SoapFault(invalid_session_fault, 'Invalid Session', 'getUploadedFiles');
     }
 }