本文整理汇总了PHP中ACL::grant方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::grant方法的具体用法?PHP ACL::grant怎么用?PHP ACL::grant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::grant方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ACL
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: setup
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: onAfterInsert
public function onAfterInsert()
{
foreach ($this->aValue as $path => $row) {
if (!empty($row)) {
ACL::grant($path, $this->getEntity());
}
}
}
示例4: testGrant
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: testCallApiOperationWithGrants
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: testDeleteAndCheckEntityDeletion
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: testDeleteGrant
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: setUp
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: testSelectAllGrantsForEntity
/**
* @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']));
}