Example #1
0
 protected function _setSecurityLevels(Base_Form_Abstract $form, $profileId, $idUser)
 {
     $modelBa = new BackendApplication();
     $modelProfileSecLevel = new ProfileSecLevel();
     $modelUser = new User();
     $user = $modelUser->FindOne($idUser);
     $setSecurityLevelsEvent = new Logger_Event_Logic('editUser', 'Edycja poziomów zabezpieczeń użytkownika ' . $user['login']);
     foreach ($modelProfileSecLevel->getLevelsForProfile($profileId) as $val) {
         $val->ghost = true;
         $params[0]['field_name'] = 'Poziom zabezpieczeń';
         $params[0]['value'] = $val->security_level;
         $setSecurityLevelsEvent->addItem('Usunięcie poprzedniego poziomu', null, $params);
         $val->save();
     }
     foreach ($modelBa->getBackendApplicationsList('application_name', 'asc') as $val) {
         $element = $form->getElement('seclvl' . $val->application_code);
         if ($element) {
             $secLevel = $modelProfileSecLevel->createRow(array('id_profile' => $profileId, 'id_backend_application' => $val->id, 'security_level' => $element->getValue(), 'created_by' => Zend_Auth::getInstance()->getIdentity()->id));
             $params = $secLevel->getUpdatedFieldsOnlyNew();
             $setSecurityLevelsEvent->addItem('Dodanie poziomu zabezpieczeń', null, $params);
             $secLevel->save();
         }
     }
     $this->logEvent($setSecurityLevelsEvent);
     //        $logger = Zend_Registry::get('logger');
     //        $logger['messages']['User'][$id] = 'Hasło zostało zmienione.';
     //        Zend_Registry::set('logger',$logger);
     return null;
 }