protected function configureLoginAttempts($perSession, $perHosts) { $register = new \SystemRegister(UsersLogin::SystemRegisterPath); $register->PerSession->value = \IntegerHelper::toNatural($perSession); $register->PerHost->value = \IntegerHelper::toNatural($perHosts); \SystemRegisterSample::createCache(); }
protected function action() { $schema = CConfig::getSchema(Record::CriticalEmailSchemaName); $result = $schema->getControlByName('to'); $result->setValue($this->getParam('notification_emails')); $register = new \SystemRegister(self::RegisterPath); $register->maximumLogLength = $this->getParam('maximumLogLength'); \SystemRegisterSample::createCache(); \CMSLog::addMessage(self::LogName, sprintf('Audit settings updated. New log length - "%s", Notification emails account - "%s"', $this->getParam('notification_emails'), $this->getParam('maximumLogLength'))); return true; }
public static function restore() { $data = array('Audit' => array('notification_emails' => '', 'maximumLogLength' => 65536), 'Security' => array('salt' => '123', 'LoginAttempts' => array('PerSession' => 5, 'PerHost' => 10), 'DDosDetector' => ['MaxConnections' => 1000, 'Message' => '', 'Period' => '1 minute']), 'Schedule' => array('runningFlag' => '0'), 'Sitemap' => array('visible' => 'false'), 'email' => array('use_standart_mail_function' => 0, 'enable_ssl' => 0, 'smtp_server' => 0, 'smtp_port' => '', 'smtp_user' => '', 'smtp_password' => '', 'from_email' => '', 'from_name' => ''), 'Front-end' => array('enable_debug' => true, 'pack' => 0, 'technical_message' => '', 'need_cms_auth' => false)); self::restorePath('/System/', $data); $applicationImport = array('users' => array('captcha_provider' => 'none', 'registration_need_email' => 1, 'front-end' => ['account_confirmation' => 1, 'account_registration_success_email' => 0])); self::restorePath('/Applications/', $applicationImport); self::restoreImageColumnConfig(); $usersConfig = array('table' => \UserAccount::TableName, 'fields' => array('id' => '\\Extasy\\Columns\\Index', 'login' => '\\Extasy\\Users\\Columns\\Login', 'email' => '\\Extasy\\Users\\Columns\\Email', 'new_email' => '\\Extasy\\Columns\\Input', 'name' => '\\Extasy\\Columns\\Input', 'avatar' => array('class' => '\\Extasy\\Columns\\Image', 'base_dir' => 'users/', 'images' => ''), 'password' => '\\Extasy\\Columns\\Password', 'rights' => '\\GrantColumn', 'last_activity_date' => '\\Extasy\\Columns\\Datetime', 'confirmation_code' => '\\Extasy\\Users\\Columns\\ConfirmationCode', 'email_confirmation_code' => '\\Extasy\\Columns\\Input', 'time_access' => '\\Extasy\\Users\\Columns\\TimeAccess', 'social_networks' => '\\Extasy\\Users\\Columns\\SocialNetworks')); Configure::write(\UserAccount::ModelConfigureKey, $usersConfig); $data = array('cconfig' => array('user_control_path' => array())); self::restorePath('/Applications/', $data); \SystemRegisterSample::createCache(); }
public function testStatuses() { $register = new \SystemRegister('System/Schedule'); $register->runningFlag->value = 1; \SystemRegisterSample::createCache(); // $api = new ServerStatus(); $this->assertEquals(1, $api->exec()); // $register = new \SystemRegister('System/Schedule'); $register->runningFlag->value = 0; \SystemRegisterSample::createCache(); $api = new ServerStatus(); $this->assertEquals(0, $api->exec()); }
use Faid\DBSimple; use Extasy\tests\Helper as TestsHelper; use UserAccount; use ACL; use Extasy\Audit\Api\ApiOperation; use Extasy\Audit\Record; use Extasy\Audit\Log; use Extasy\tests\system_register\Restorator; use Extasy\Columns\Password as passwordColumn; $register = new \SystemRegister('/System/'); try { $register->delete('Audit'); } catch (\Exception $e) { } Restorator::restore(); \SystemRegisterSample::createCache(); TestsHelper::dbFixture(ACL_TABLE, array()); ACL::create(ApiOperation::RightName); // user record TestsHelper::dbFixture(USERS_TABLE, array(array('login' => 'login', 'password' => passwordColumn::hash('testtest')), array('login' => 'guest', 'password' => passwordColumn::hash('testtest')))); // grant user permission $user = UserAccount::getByLogin('login'); ACL::grant(ApiOperation::RightName, $user->obj_rights->getEntity()); \UsersLogin::login('login', 'testtest'); // base logs TestsHelper::dbFixture(Log::getTableName(), array(array('name' => 'Log1', 'critical' => 0, 'enable_logging' => 1), array('name' => 'Log2', 'critical' => 1, 'enable_logging' => 1))); // base records // - [different by user_id] // - [different by date] // - [different by content] TestsHelper::dbFixture(Record::getTableName(), array(array('log_id' => 1, 'date' => '2001-01-01 00:00:00', 'short' => 'short log', 'full' => 'full_log', 'user_id' => 1, 'user_login' => 'login'), array('log_id' => 2, 'date' => '2001-01-02 00:00:00', 'short' => 'short log', 'full' => 'full_log', 'user_id' => 1, 'user_login' => 'login'), array('log_id' => 1, 'date' => '2001-01-03 00:00:00', 'short' => 'short log', 'full' => 'full_log')));
public function testRunnerNotWorksOnSystemRegisterFlag() { $register = new \SystemRegister('System/Schedule'); $register->runningFlag->value = 0; \SystemRegisterSample::createCache(); // $job = new TestAction(); $job->insert(); // $runner = new Runner(); $runner->resolveJobs(); // $this->assertFalse(TestAction::isCalled()); $job = TestAction::getById($job->id->getValue()); $this->assertEquals(TestAction::NewStatus, $job->status->getValue()); }
public function setUp() { CDumper::importFile(dirname(__FILE__) . '/import.sql'); SystemRegisterSample::createCache(); }
public function delete($id) { $node = SystemRegisterHelper::createById($id); if (is_subclass_of($node, 'SystemRegister') || get_class($node) == 'SystemRegister') { $aPath = explode('/', $node->getFullPath()); $szKey = $aPath = $aPath[sizeof($aPath) - 1]; $node->getParent()->delete($szKey); } else { $szKey = $node->name; $node->parent->delete($szKey); } SystemRegisterSample::createCache(); die; }
protected function action() { $register = new \SystemRegister('System/Schedule'); $register->runningFlag->value = intval($this->getParam('runningFlag')); \SystemRegisterSample::createCache(); }
public function post($ssl, $server, $port, $name, $password, $from_email, $from_name) { $this->register->enable_ssl->value = $ssl; $this->register->smtp_server->value = $server; $this->register->smtp_port->value = $port; $this->register->smtp_user->value = $name; $this->register->smtp_password->value = $password; $this->register->from_email->value = $from_email; $this->register->from_name->value = $from_name; SystemRegisterSample::createCache(); $this->addAlert('Настройки сохранены'); $this->jumpBack(); }
public static function setupRootDocuments(array $documentList) { $register = new SystemRegister(self::RootDocumentsKey); SystemRegisterHelper::import($register, $documentList); SystemRegisterSample::createCache(); }