コード例 #1
0
ファイル: ajax_appMgmtSave.php プロジェクト: bitking/sysPass
 $User->setUserName(SP\Request::analyze('name'));
 $User->setUserLogin(SP\Request::analyze('login'));
 $User->setUserEmail(SP\Request::analyze('email'));
 $User->setUserNotes(SP\Request::analyze('notes'));
 $User->setUserGroupId(SP\Request::analyze('groupid', 0));
 $User->setUserProfileId(SP\Request::analyze('profileid', 0));
 $User->setUserIsAdminApp(SP\Request::analyze('adminapp', 0, false, 1));
 $User->setUserIsAdminAcc(SP\Request::analyze('adminacc', 0, false, 1));
 $User->setUserIsDisabled(SP\Request::analyze('disabled', 0, false, 1));
 $User->setUserChangePass(SP\Request::analyze('changepass', 0, false, 1));
 $User->setUserPass(SP\Request::analyzeEncrypted('pass'));
 // Nuevo usuario o editar
 if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_NEW || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDIT) {
     if (!$User->getUserName() && !$isLdap) {
         SP\Response::printJSON(_('Es necesario un nombre de usuario'), 2);
     } elseif (!$User->getUserLogin() && !$isLdap) {
         SP\Response::printJSON(_('Es necesario un login'), 2);
     } elseif (!$User->getUserProfileId()) {
         SP\Response::printJSON(_('Es necesario un perfil'), 2);
     } elseif (!$User->getUserGroupId()) {
         SP\Response::printJSON(_('Es necesario un grupo'), 2);
     } elseif (!$User->getUserEmail() && !$isLdap) {
         SP\Response::printJSON(_('Es necesario un email'), 2);
     } elseif (SP\Util::demoIsEnabled() && !\SP\Session::getUserIsAdminApp() && $User->getUserLogin() == 'demo') {
         SP\Response::printJSON(_('Ey, esto es una DEMO!!'));
     }
     switch ($User->checkUserExist()) {
         case UserUtil::USER_LOGIN_EXIST:
             SP\Response::printJSON(_('Login de usuario duplicado'), 2);
             break;
         case UserUtil::USER_MAIL_EXIST: