예제 #1
0
파일: UsersTest.php 프로젝트: gudwin/extasy
 protected function configureLoginAttempts($perSession, $perHosts)
 {
     $register = new \SystemRegister(UsersLogin::SystemRegisterPath);
     $register->PerSession->value = \IntegerHelper::toNatural($perSession);
     $register->PerHost->value = \IntegerHelper::toNatural($perHosts);
     \SystemRegisterSample::createCache();
 }
예제 #2
0
 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;
 }
예제 #3
0
 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();
 }
예제 #4
0
 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());
 }
예제 #5
0
파일: fixtures.php 프로젝트: gudwin/extasy
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')));
예제 #6
0
 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());
 }
예제 #7
0
파일: base.php 프로젝트: gudwin/extasy
 public function setUp()
 {
     CDumper::importFile(dirname(__FILE__) . '/import.sql');
     SystemRegisterSample::createCache();
 }
예제 #8
0
파일: regedit.php 프로젝트: gudwin/extasy
 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;
 }
예제 #9
0
 protected function action()
 {
     $register = new \SystemRegister('System/Schedule');
     $register->runningFlag->value = intval($this->getParam('runningFlag'));
     \SystemRegisterSample::createCache();
 }
예제 #10
0
파일: config.php 프로젝트: gudwin/extasy
 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();
 }
예제 #11
0
파일: cms.php 프로젝트: gudwin/extasy
 public static function setupRootDocuments(array $documentList)
 {
     $register = new SystemRegister(self::RootDocumentsKey);
     SystemRegisterHelper::import($register, $documentList);
     SystemRegisterSample::createCache();
 }