/**
  * Stores the submitted data to the backend / the loginprovider
  *
  * @return string
  */
 protected function actionSaveUser()
 {
     $strReturn = "";
     $bitSelfedit = false;
     $objUsersources = new class_module_user_sourcefactory();
     if ($this->getParam("mode") == "new") {
         if (!$this->getObjModule()->rightEdit()) {
             return $this->getLang("commons_error_permissions");
         }
         $objSubsystem = $objUsersources->getUsersource($this->getParam("usersource"));
         $objBlankUser = $objSubsystem->getNewUser();
         $objForm = $this->getUserForm($objBlankUser, false, "new");
     } else {
         if (!$this->getObjModule()->rightEdit()) {
             if ($this->getSystemid() == $this->objSession->getUserID() && class_module_system_setting::getConfigValue("_user_selfedit_") == "true") {
                 $bitSelfedit = true;
             } else {
                 return $this->getLang("commons_error_permissions");
             }
         }
         $objUser = new class_module_user_user($this->getSystemid());
         $objSourceUser = $objUsersources->getSourceUser($objUser);
         $objForm = $this->getUserForm($objSourceUser, $bitSelfedit, "edit");
     }
     if (($this->getParam("mode") == "new" && !$this->checkAdditionalNewData($objForm)) | ($this->getParam("mode") == "edit" && !$this->checkAdditionalEditData($objForm)) | !$objForm->validateForm()) {
         return $this->actionNewUser($this->getParam("mode"), $objForm);
     }
     $objUser = null;
     if ($this->getParam("mode") == "new") {
         //create a new user and pass all relevant data
         $objUser = new class_module_user_user();
         $objUser->setStrSubsystem($this->getParam("usersource"));
         $objUser->setStrUsername($this->getParam("user_username"));
         $objUser->setIntActive($this->getParam("user_active") != "" && $this->getParam("user_active") == "checked" ? 1 : 0);
         $objUser->setIntAdmin($this->getParam("user_adminlogin") != "" && $this->getParam("user_adminlogin") == "checked" ? 1 : 0);
         $objUser->setIntPortal($this->getParam("user_portal") != "" && $this->getParam("user_portal") == "checked" ? 1 : 0);
     } else {
         if ($this->getParam("mode") == "edit") {
             //create a new user and pass all relevant data
             $objUser = new class_module_user_user($this->getSystemid());
             if (!$bitSelfedit) {
                 $objUser->setStrUsername($this->getParam("user_username"));
                 $objUser->setIntActive($this->getParam("user_active") != "" && $this->getParam("user_active") == "checked" ? 1 : 0);
                 $objUser->setIntAdmin($this->getParam("user_adminlogin") != "" && $this->getParam("user_adminlogin") == "checked" ? 1 : 0);
                 $objUser->setIntPortal($this->getParam("user_portal") != "" && $this->getParam("user_portal") == "checked" ? 1 : 0);
             }
         }
     }
     $objUser->setStrAdminskin($this->getParam("user_skin"));
     $objUser->setStrAdminlanguage($this->getParam("user_language"));
     $objUser->setStrAdminModule($this->getParam("user_startmodule"));
     $objUser->setIntItemsPerPage($this->getParam("user_items_per_page"));
     $objUser->updateObjectToDb();
     $objSourceUser = $objUser->getObjSourceUser();
     $objForm = $this->getUserForm($objSourceUser, $bitSelfedit, $this->getParam("mode"));
     $objForm->updateSourceObject();
     $objSourceUser->updateObjectToDb();
     // assign user to the same groups if we have an user where we inherit the group settings
     if ($this->getParam("mode") == "new") {
         $strInheritUserId = $this->getParam("user_inherit_permissions_id");
         if (!empty($strInheritUserId)) {
             $objInheritUser = new class_module_user_user($strInheritUserId);
             $arrGroupIds = $objInheritUser->getArrGroupIds();
             foreach ($arrGroupIds as $strGroupId) {
                 $objGroup = new class_module_user_group($strGroupId);
                 $objSourceGroup = $objGroup->getObjSourceGroup();
                 $objSourceGroup->addMember($objUser->getObjSourceUser());
             }
             $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "editMemberships", "&systemid=" . $objUser->getStrSystemid()));
             return "";
         }
     }
     if ($this->getParam("mode") == "edit") {
         //Reset the admin-skin cookie to force the new skin
         $objCookie = new class_cookie();
         //flush the db-cache
         class_carrier::getInstance()->getObjDB()->flushQueryCache();
         $this->objSession->resetUser();
         //and update the cookie
         $objCookie->setCookie("adminskin", $this->objSession->getAdminSkin(false, true));
         //update language set before
         $objCookie->setCookie("adminlanguage", $this->objSession->getAdminLanguage(false, true));
     }
     //flush the navigation cache in order to get new items for a possible updated list
     class_admin_helper::flushActionNavigationCache();
     if ($this->getObjModule()->rightView()) {
         $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list"));
     } else {
         $this->adminReload(class_link::getLinkAdminHref($objUser->getStrAdminModule()));
     }
     return $strReturn;
 }