コード例 #1
0
 function test_join_test()
 {
     ACL::add('dummy', 'blog:posts', 'add');
     $acl = new ACL();
     $this->assertTrue($acl->grant('dummy', 'blog:posts', 'add'));
     $this->assertFalse($acl->grant('dummy', 'blog:posts', 'edit'));
     ACL::remove('dummy', 'blog:posts', 'add');
     $this->assertFalse($acl->grant('dummy', 'blog:posts', 'add'));
 }
コード例 #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
ファイル: grant.php プロジェクト: gudwin/extasy
 public function onAfterInsert()
 {
     foreach ($this->aValue as $path => $row) {
         if (!empty($row)) {
             ACL::grant($path, $this->getEntity());
         }
     }
 }
コード例 #4
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']);
 }
コード例 #5
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());
 }
コード例 #6
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'));
 }
コード例 #7
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));
 }
コード例 #8
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();
 }
コード例 #9
0
ファイル: miscTest.php プロジェクト: gudwin/extasy
 /**
  * @group testSelectAllGrantsForEntity
  */
 public function testSelectAllGrantsForEntity()
 {
     ACL::create('test');
     ACL::create('test2');
     ACL::create('test3');
     ACL::grant('test', 'obj1');
     ACL::grant('test2', 'obj2');
     ACL::grant('test3', 'obj1');
     $grantsList = ACL::selectAllGrantsForEntity('obj1');
     $this->assertEquals(2, sizeof($grantsList));
     $this->assertFalse(!empty($grantsList['test2']));
     $this->assertTrue(!empty($grantsList['test3']));
     $this->assertTrue(!empty($grantsList['test']));
 }