本文整理汇总了PHP中ACL::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::create方法的具体用法?PHP ACL::create怎么用?PHP ACL::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::create方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
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: 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: 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']);
}
示例4: testCreateWithCheckValues
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: testExport
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: 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());
}
示例7: 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'));
}
示例8: 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));
}
示例9: setUp
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: call
public function call($method, $path, $title = '')
{
switch ($method) {
case 'create':
print ACL::create($path, $title);
break;
case 'remove':
ACL::remove($path);
break;
}
die;
}
示例11: 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();
}
示例12: cleanACL
public static function cleanACL()
{
self::dbFixture(ACL_GRANT_TABLE, array());
self::dbFixture(ACL_TABLE, array());
\ACL::create(\CMSAuth::AdministratorRoleName);
}
示例13: install
public static function install()
{
ACL::create(self::SystemAdministratorRoleName, 'System Administrator');
ACL::create(self::AdministratorRoleName, 'Administrator');
}