// Comprobar si se ha forzado un cambio de clave if ($User->isUserChangePass()) { $hash = SP\Util::generate_random_bytes(); if (UserPassRecover::addPassRecover($userLogin, $hash)) { $url = SP\Init::$WEBURI . '/index.php?a=passreset&h=' . $hash . '&t=' . time() . '&f=1'; SP\Response::printJSON($url, 0); } } // Obtenemos la clave maestra del usuario if ($User->getUserMPass()) { // Actualizar el último login del usuario UserUtil::setUserLastLogin($User->getUserId()); // Cargar las variables de sesión del usuario SessionUtil::loadUserSession($User); $Log->addDescription(sprintf('%s: %s', _('Usuario'), $userLogin)); $Log->addDescription(sprintf('%s: %s', _('Perfil'), SP\Profile::getProfileNameById($User->getUserProfileId()))); $Log->addDescription(sprintf('%s: %s', _('Grupo'), SP\Groups::getGroupNameById($User->getUserGroupId()))); $Log->writeLog(); } else { SP\Response::printJSON(_('Error interno')); } $UserPrefs = \SP\UserPreferences::getPreferences($User->getUserId()); if ($UserPrefs->isUse2Fa()) { SP\Session::set2FApassed(false); $url = SP\Init::$WEBURI . '/index.php?a=2fa&i=' . $User->getUserId() . '&t=' . time() . '&f=1'; SP\Response::printJSON($url, 0); } else { SP\Session::set2FApassed(true); } SP\Language::setLanguage(true); SP\Themes::setTheme(true);
$uses[] = _('Usuarios') . " (" . $resGroupUse['users'] . ")"; } if ($resGroupUse['accounts'] > 0) { $uses[] = _('Cuentas') . " (" . $resGroupUse['accounts'] . ")"; } SP\Response::printJSON(_('No es posible eliminar') . ';;' . _('Grupo en uso por:') . ';;' . implode(';;', $uses)); } else { $groupName = SP\Groups::getGroupNameById($itemId); if (SP\Groups::deleteGroup() && SP\CustomFields::deleteCustomFieldForItem($itemId, \SP\Controller\ActionsInterface::ACTION_USR_GROUPS)) { SP\Response::printJSON(_('Grupo eliminado'), 0, $doActionOnClose); } SP\Response::printJSON(_('Error al eliminar el grupo')); } } } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_DELETE) { $Profile = new \SP\Profile(); // Variables POST del formulario $name = SP\Request::analyze('profile_name'); $Profile->setName($name); $Profile->setId(SP\Request::analyze('itemId', 0)); $Profile->setAccAdd(SP\Request::analyze('profile_accadd', 0, false, 1)); $Profile->setAccView(SP\Request::analyze('profile_accview', 0, false, 1)); $Profile->setAccViewPass(SP\Request::analyze('profile_accviewpass', 0, false, 1)); $Profile->setAccViewHistory(SP\Request::analyze('profile_accviewhistory', 0, false, 1)); $Profile->setAccEdit(SP\Request::analyze('profile_accedit', 0, false, 1)); $Profile->setAccEditPass(SP\Request::analyze('profile_acceditpass', 0, false, 1)); $Profile->setAccDelete(SP\Request::analyze('profile_accdel', 0, false, 1)); $Profile->setAccFiles(SP\Request::analyze('profile_accfiles', 0, false, 1)); $Profile->setConfigGeneral(SP\Request::analyze('profile_config', 0, false, 1)); $Profile->setConfigEncryption(SP\Request::analyze('profile_configmpw', 0, false, 1)); $Profile->setConfigBackup(SP\Request::analyze('profile_configback', 0, false, 1));