当前位置: 首页>>代码示例>>PHP>>正文


PHP ACL::grant方法代码示例

本文整理汇总了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'));
 }
开发者ID:arunoda-susiripala,项目名称:Code51,代码行数:9,代码来源:acl_helper.php

示例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());
 }
开发者ID:gudwin,项目名称:extasy,代码行数:8,代码来源:DashboardRouteTest.php

示例3: onAfterInsert

 public function onAfterInsert()
 {
     foreach ($this->aValue as $path => $row) {
         if (!empty($row)) {
             ACL::grant($path, $this->getEntity());
         }
     }
 }
开发者ID:gudwin,项目名称:extasy,代码行数:8,代码来源:grant.php

示例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']);
 }
开发者ID:gudwin,项目名称:extasy,代码行数:8,代码来源:grantTest.php

示例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());
 }
开发者ID:gudwin,项目名称:extasy,代码行数:10,代码来源:ApiOperationTest.php

示例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'));
 }
开发者ID:gudwin,项目名称:extasy,代码行数:10,代码来源:deleteTest.php

示例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));
 }
开发者ID:gudwin,项目名称:extasy,代码行数:10,代码来源:isGrantedTest.php

示例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();
 }
开发者ID:gudwin,项目名称:extasy,代码行数:13,代码来源:BaseTest.php

示例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']));
 }
开发者ID:gudwin,项目名称:extasy,代码行数:17,代码来源:miscTest.php


注:本文中的ACL::grant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。