예제 #1
0
 $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));
 $Profile->setConfigImport(SP\Request::analyze('profile_configimport', 0, false, 1));
 $Profile->setMgmCategories(SP\Request::analyze('profile_categories', 0, false, 1));
 $Profile->setMgmCustomers(SP\Request::analyze('profile_customers', 0, false, 1));
 $Profile->setMgmCustomFields(SP\Request::analyze('profile_customfields', 0, false, 1));
 $Profile->setMgmUsers(SP\Request::analyze('profile_users', 0, false, 1));
 $Profile->setMgmGroups(SP\Request::analyze('profile_groups', 0, false, 1));
 $Profile->setMgmProfiles(SP\Request::analyze('profile_profiles', 0, false, 1));
 $Profile->setMgmApiTokens(SP\Request::analyze('profile_apitokens', 0, false, 1));
 $Profile->setEvl(SP\Request::analyze('profile_eventlog', 0, false, 1));
 if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT) {
     if (!$Profile->getName()) {
         SP\Response::printJSON(_('Es necesario un nombre de perfil'), 2);
     } elseif (SP\Profile::checkProfileExist($Profile->getId(), $Profile->getName())) {
         SP\Response::printJSON(_('Nombre de perfil duplicado'), 2);
     }