/**
  * Create a new project
  *
  * This method throw an exception if there is a conflict on names or if there is an error during the creation process.
  * 
  * You can select:
  * * The privacy of the project 'private' or 'public'
  * * The projectId of the template (100 means default template aka default new project).
  * 
  * It assumes a couple of things:
  * * The project type is "Project" (Not modifiable)
  * * There is no "Project description" nor any "Project description fields" (long desc, patents, IP, other software)
  * * The project services are inherited from the template
  * * There is no trove cat selected
  * * The default Software Policy is "Site exchange policy".
  *
  * Projects are automatically accepted
  *
  * Error codes:
  * * 3001, Invalid session (wrong $sessionKey)
  * * 3200, Only site admin is allowed to create project on behalf of users (wrong $adminSessionKey)
  * * 3100, Invalid template id (correponding project doesn't exist)
  * * 3101, Project creation failure
  * * 3102, Invalid short name
  * * 3103, Invalid full name
  * * 3104, Project is not a template
  * * 4000, SOAP Call Quota exceeded (you created to much project during the last hour, according to configuration)
  * 
  * @param String  $sessionKey      Session key of the desired project admin
  * @param String  $adminSessionKey Session key of a site admin
  * @param String  $shortName       Unix name of the project
  * @param String  $publicName      Full name of the project
  * @param String  $privacy         Either 'public' or 'private'
  * @param Integer $templateId      Id of template project
  *
  * @return Integer The ID of newly created project
  */
 public function addProject($sessionKey, $adminSessionKey, $shortName, $publicName, $privacy, $templateId)
 {
     $this->continueAdminSession($adminSessionKey);
     $requester = $this->continueSession($sessionKey);
     $template = $this->getTemplateById($templateId, $requester);
     try {
         $this->limitator->logCallTo('addProject');
         return $this->formatDataAndCreateProject($shortName, $publicName, $privacy, $template);
     } catch (Exception $e) {
         throw new SoapFault((string) $e->getCode(), $e->getMessage());
     }
 }
 /**
  * Create a new project
  *
  * This method throw an exception if there is a conflict on names or if there is an error during the creation process.
  * 
  * You can select:
  * * The privacy of the project 'private' or 'public'
  * * The projectId of the template (100 means default template aka default new project).
  * 
  * It assumes a couple of things:
  * * The project type is "Project" (Not modifiable)
  * * There is no "Project description" nor any "Project description fields" (long desc, patents, IP, other software)
  * * The project services are inherited from the template
  * * There is no trove cat selected
  * * The default Software Policy is "Site exchange policy".
  *
  * Projects are automatically accepted
  *
  * Error codes:
  * * 3001, Invalid session (wrong $sessionKey)
  * * 3200, Only site admin is allowed to create project on behalf of users (wrong $adminSessionKey)
  * * 3100, Invalid template id (correponding project doesn't exist)
  * * 3101, Project creation failure
  * * 3102, Invalid short name
  * * 3103, Invalid full name
  * * 3104, Project is not a template
  * * 3105, Generic User creation failure
  * * 4000, SOAP Call Quota exceeded (you created to much project during the last hour, according to configuration)
  * 
  * @param String  $sessionKey      Session key of the desired project admin
  * @param String  $adminSessionKey Session key of a site admin
  * @param String  $shortName       Unix name of the project
  * @param String  $publicName      Full name of the project
  * @param String  $privacy         Either 'public' or 'private'
  * @param Integer $templateId      Id of template project
  *
  * @return Integer The ID of newly created project
  */
 public function addProject($sessionKey, $adminSessionKey, $shortName, $publicName, $privacy, $templateId)
 {
     $requester = $this->continueSession($sessionKey);
     $has_special_access = $this->doesUserHavePermission($requester, new User_ForgeUserGroupPermission_ProjectApproval());
     if (!$has_special_access) {
         $this->checkAdminSessionIsValid($adminSessionKey, $sessionKey);
     }
     $template = $this->getTemplateById($templateId, $requester);
     try {
         $this->limitator->logCallTo('addProject');
         return $this->formatDataAndCreateProject($shortName, $publicName, $privacy, $template);
     } catch (Exception $e) {
         throw new SoapFault((string) $e->getCode(), $e->getMessage());
     }
 }
 public function testTwoRequestsShouldThrowAnException()
 {
     $dao = $this->GivenThereWasAlreadyTenCallToAddProject();
     $this->expectException('SOAP_NbRequestsExceedLimit_Exception');
     $limitator = new SOAP_RequestLimitator($nb_call = 10, $timeframe = 3600, $dao);
     $limitator->logCallTo('addProject');
 }