コード例 #1
0
ファイル: SitemapMenuItemTest.php プロジェクト: gudwin/extasy
 public function setUp()
 {
     parent::setUp();
     $model = new TestDocument();
     $model->createDatabaseTable(true);
     Helper::dbFixture(SITEMAP_TABLE, []);
     \ACL::create(SitemapModel::PermissionName);
     Configure::write('Sitemap', ['Menu' => ['title' => self::Title, 'depth' => 3]]);
     Helper::setupUsers([['login' => self::AdminUser, 'rights' => [SitemapModel::PermissionName => true]], ['login' => self::GuestUser]]);
     $documents = [['name' => 'first', 'sitemap' => ['count' => 1]], ['name' => 'second'], ['name' => 'third', 'sitemap' => ['parent' => 1]]];
     foreach ($documents as $key => $row) {
         $documents[$key] = new TestDocument($row);
         $documents[$key]->insert();
         $sitemapModel = new SitemapModel();
         $sitemapModel->name = $row['name'];
         $sitemapModel->full_url = $row['name'];
         $sitemapModel->linkToModel($documents[$key]);
         if (isset($row['sitemap'])) {
             foreach ($row['sitemap'] as $key => $value) {
                 $sitemapModel->{$key} = $value;
             }
         }
         $sitemapModel->insert();
     }
 }
コード例 #2
0
ファイル: DashboardRouteTest.php プロジェクト: gudwin/extasy
 public function setup()
 {
     parent::setUp();
     \ACL::create(\CMSAuth::AdministratorRoleName);
     Helper::setupUsers(array(array('login' => self::login, 'password' => self::password, 'rights' => array(\CMSAuth::AdministratorRoleName => true))));
     $user = \UserAccount::getByLogin(self::login);
     \ACL::grant(\CMSAuth::AdministratorRoleName, $user->rights->getEntity());
 }
コード例 #3
0
ファイル: grantTest.php プロジェクト: gudwin/extasy
 public function testGrant()
 {
     ACL::create('test/test2');
     ACL::grant('test/test2', 'e1');
     $this->assertEquals(1, DBSimple::getRowsCount(ACL_GRANT_TABLE));
     $found = DBSimple::get(ACL_GRANT_TABLE, array('actionId' => 2));
     $this->assertEquals('e1', $found['entity']);
 }
コード例 #4
0
ファイル: createTest.php プロジェクト: gudwin/extasy
 public function testCreateWithCheckValues()
 {
     ACL::create('test/test2');
     $result = DBSimple::get(ACL_TABLE, array('id' => 1));
     $this->assertEquals('test', $result['name']);
     $result = DBSimple::get(ACL_TABLE, array('id' => 2));
     $this->assertEquals('test2', $result['name']);
 }
コード例 #5
0
ファイル: miscTest.php プロジェクト: gudwin/extasy
 public function testExport()
 {
     ACL::create('a/b/c');
     ACL::create('a/b/d');
     ACL::create('a/e');
     $exported = ACLMisc::export();
     $this->assertEquals(1, sizeof($exported));
     $this->assertEquals(2, sizeof($exported[0]['children']));
     $this->assertEquals(2, sizeof($exported[0]['children'][0]['children']));
 }
コード例 #6
0
ファイル: ApiOperationTest.php プロジェクト: gudwin/extasy
 public function testCallApiOperationWithGrants()
 {
     TestsHelper::dbFixture(\UserAccount::getTableName(), array(array('login' => 'test', 'password' => passwordColumn::hash('testtest'))));
     $user = \UserAccount::getById(1);
     \ACL::create(TestApiWithACLOperation::RightName);
     \ACL::grant(TestApiWithACLOperation::RightName, $user->obj_rights->getEntity());
     \UsersLogin::login('test', 'testtest');
     $method = new TestApiWithACLOperation();
     $this->assertTrue($method->exec());
 }
コード例 #7
0
ファイル: deleteTest.php プロジェクト: gudwin/extasy
 public function testDeleteAndCheckEntityDeletion()
 {
     ACL::create('test/test2/test3');
     ACL::grant('test/test2/test3', 'o1');
     ACL::grant('test', 'o2');
     ACL::remove('test/test2');
     $this->assertEquals(1, DBSimple::getRowsCount(ACL_GRANT_TABLE));
     // Проверяем, что удалились именно нужные данные
     $this->assertEquals(true, ACL::isGranted('test', 'o2'));
 }
コード例 #8
0
ファイル: isGrantedTest.php プロジェクト: gudwin/extasy
 public function testDeleteGrant()
 {
     $path = 'test/test2';
     $entity = 'obj1';
     ACL::create($path);
     ACL::grant($path, $entity);
     $this->assertEquals(true, ACL::isGranted($path, $entity));
     ACL::unGrant($path, $entity);
     $this->assertEquals(false, ACL::isGranted($path, $entity));
 }
コード例 #9
0
ファイル: SearchTest.php プロジェクト: gudwin/extasy
 public function setUp()
 {
     parent::setUp();
     \EventController::cleanUp();
     \ACL::create(\CMSAuth::SystemAdministratorRoleName);
     \ACL::create(\CMSAuth::AdministratorRoleName);
     \ACL::create(\UserAccount::PermissionName);
     \ACL::create(\Extasy\sitemap\Models\SitemapModel::PermissionName);
     Helper::dbFixtures([SITEMAP_TABLE => [['name' => 'root', 'full_url' => '/root/', 'document_id' => 1], ['name' => '/apple/', 'full_url' => '/apple/', 'document_id' => 1], ['name' => '/banana/', 'full_url' => '/banana/', 'document_id' => 1], ['name' => 'orange', 'full_url' => '/orange/', 'document_id' => 1], ['name' => '/pineapple/', 'full_url' => '/pineapple/', 'document_id' => 1]]]);
     Helper::setupUsers([['login' => 'root', 'password' => self::PASSWORD, 'rights' => [\CMSAuth::SystemAdministratorRoleName => 1]], ['login' => 'clean_admin', 'password' => self::PASSWORD, 'rights' => [\CMSAuth::AdministratorRoleName => 1]], ['login' => 'users', 'password' => self::PASSWORD, 'rights' => [\CMSAuth::AdministratorRoleName => 1, \UserAccount::PermissionName => 1]], ['login' => 'sitemap', 'password' => self::PASSWORD, 'rights' => [\CMSAuth::AdministratorRoleName => 1, \Extasy\sitemap\Models\SitemapModel::PermissionName => 1]]]);
     \UsersLogin::logout();
 }
コード例 #10
0
ファイル: index.php プロジェクト: gudwin/extasy
 public function call($method, $path, $title = '')
 {
     switch ($method) {
         case 'create':
             print ACL::create($path, $title);
             break;
         case 'remove':
             ACL::remove($path);
             break;
     }
     die;
 }
コード例 #11
0
ファイル: BaseTest.php プロジェクト: gudwin/extasy
 public function setUp()
 {
     parent::setUp();
     Helper::dbFixture(Job::TableName, array());
     $this->setRunnerTimeout(0);
     Restorator::restore();
     Helper::setupUsers([['login' => self::Login, 'password' => self::Password], ['login' => 'guest', 'password' => self::Password]]);
     $user = \UserAccount::getByLogin(self::Login);
     \ACL::create(\CMSAuth::SystemAdministratorRoleName);
     \ACL::grant(\CMSAuth::SystemAdministratorRoleName, $user->rights->getEntity());
     \UsersLogin::forceLogin($user);
     TestAction::setUp();
 }
コード例 #12
0
ファイル: Helper.php プロジェクト: gudwin/extasy
 public static function cleanACL()
 {
     self::dbFixture(ACL_GRANT_TABLE, array());
     self::dbFixture(ACL_TABLE, array());
     \ACL::create(\CMSAuth::AdministratorRoleName);
 }
コード例 #13
0
ファイル: auth.class.php プロジェクト: gudwin/extasy
 public static function install()
 {
     ACL::create(self::SystemAdministratorRoleName, 'System Administrator');
     ACL::create(self::AdministratorRoleName, 'Administrator');
 }