/**
  * Add mapping repository_user -> activecollab user
  *
  * @param void
  * @return null
  */
 function repository_user_add()
 {
     if (!$this->active_repository->canEdit($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, null, true);
     }
     // if
     if (!$this->request->isSubmitted()) {
         $this->httpError(HTTP_ERR_BAD_REQUEST, null, true);
     }
     //if
     if (!$this->request->isAsyncCall()) {
         $this->httpError(HTTP_ERR_BAD_REQUEST, null, true);
     }
     //if
     $source_user = new SourceUser();
     $source_user->setRepositoryId($this->active_repository->getId());
     $source_user->setRepositoryUser($this->request->post('repository_user'));
     $source_user->setUserId($this->request->post('user_id'));
     // validation is moved here because the management form is not on separate page
     if (!$source_user->validatePresenceOf('user_id')) {
         die('error');
     }
     // if
     $save = $source_user->save();
     if ($save && !is_error($save)) {
         $source_user->setSystemUser();
         $this->smarty->assign('source_user', $source_user);
         $this->smarty->display(get_template_path('_repository_user_row', 'repository', SOURCE_MODULE));
         die;
     } else {
         die('error');
     }
     // if
 }