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')); }
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()); }
public function onAfterInsert() { foreach ($this->aValue as $path => $row) { if (!empty($row)) { ACL::grant($path, $this->getEntity()); } } }
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']); }
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()); }
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')); }
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)); }
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(); }
/** * @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'])); }