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


PHP Zend_Acl::inheritsRole方法代码示例

本文整理汇总了PHP中Zend_Acl::inheritsRole方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Acl::inheritsRole方法的具体用法?PHP Zend_Acl::inheritsRole怎么用?PHP Zend_Acl::inheritsRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Acl的用法示例。


在下文中一共展示了Zend_Acl::inheritsRole方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLoadRoles

 /**
  * @covers System_Acl_Loader_Options::load
  * @covers System_Acl_Loader_Options::<protected>
  */
 public function testLoadRoles()
 {
     $this->object->setOptions($this->optionsHelper(System_Acl_Loader_Options::ROLES, array('test' => null, 'test1' => 'test')));
     $this->object->load();
     self::assertTrue($this->acl->hasRole('test'));
     self::assertTrue($this->acl->hasRole('test1'));
     self::assertTrue($this->acl->inheritsRole('test1', 'test', true));
 }
开发者ID:kandy,项目名称:system,代码行数:12,代码来源:OptionsTest.php

示例2: testLoadRoles

 /**
  * @covers System_Acl_Loader_Db::load
  * @covers System_Acl_Loader_Db::<protected>
  */
 public function testLoadRoles()
 {
     $this->createTableMocks('AclResource');
     $this->createTableMocks('AclRule');
     $this->createTableMocks('AclRole', array(array('name' => 'test', 'parent' => null), array('name' => 'test1', 'parent' => 'test')));
     $this->object->load();
     self::assertTrue($this->acl->hasRole('test'));
     self::assertTrue($this->acl->hasRole('test1'));
     self::assertTrue($this->acl->inheritsRole('test1', 'test', true));
 }
开发者ID:kandy,项目名称:system,代码行数:14,代码来源:DbTest.php

示例3: testRoleInheritanceSupportsCheckingOnlyParents

 /**
  * Ensures that the $onlyParents argument to inheritsRole() works
  *
  * @return void
  * @group  ZF-2502
  */
 public function testRoleInheritanceSupportsCheckingOnlyParents()
 {
     $this->_acl->addRole(new Role\GenericRole('grandparent'))
                ->addRole(new Role\GenericRole('parent'), 'grandparent')
                ->addRole(new Role\GenericRole('child'), 'parent');
     $this->assertFalse($this->_acl->inheritsRole('child', 'grandparent', true));
 }
开发者ID:benivaldo,项目名称:zf2-na-pratica,代码行数:13,代码来源:AclTest.php

示例4: _acceptAcl

 /**
  * Determines whether a page should be accepted when iterating using ACL
  * 
  * Validates that the role set in helper inherits or is the same as
  * the role(s) found in the page
  * 
  * @return bool
  */
 protected function _acceptAcl(Zym_Navigation_Page $page, $recursive = true)
 {
     // do not accept by default
     $accept = false;
     if (!($helperRole = $this->getRole())) {
         // don't accept if helper has no role
         return false;
     }
     if (!($pageRole = $page->getRole())) {
         // accept it if page has no role
         $accept = true;
     } else {
         // loop all roles
         foreach ($helperRole as $hRole) {
             foreach ($pageRole as $pRole) {
                 if ($hRole == $pRole || $this->_acl->inheritsRole($hRole, $pRole)) {
                     $accept = true;
                     break;
                 }
             }
             if ($accept) {
                 break;
             }
         }
     }
     // loop parent(s) recursively if page is accepted and recurisve is true
     if ($accept && $recursive) {
         $parent = $page->getParent();
         if ($parent instanceof Zym_Navigation_Page) {
             $accept = $this->_acceptAcl($parent, true);
         }
     }
     return $accept;
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:42,代码来源:NavigationAbstract.php

示例5: testRoleRegistryInheritsNonExistent

 /**
  * Ensures that an exception is thrown when a non-existent Role is specified to each parameter of inherits()
  *
  * @return void
  */
 public function testRoleRegistryInheritsNonExistent()
 {
     $roleGuest = new Zend_Acl_Role('guest');
     $this->_acl->addRole($roleGuest);
     try {
         $this->_acl->inheritsRole('nonexistent', $roleGuest);
         $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent child Role');
     } catch (Zend_Acl_Role_Registry_Exception $e) {
         $this->assertContains('not found', $e->getMessage());
     }
     try {
         $this->_acl->inheritsRole($roleGuest, 'nonexistent');
         $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent Role');
     } catch (Zend_Acl_Role_Registry_Exception $e) {
         $this->assertContains('not found', $e->getMessage());
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:22,代码来源:AclTest.php

示例6: getDefaultGroup

 public function getDefaultGroup()
 {
     $groups = $this->getActiveStaffGroups();
     $roles = $this->db->fetchPairs('SELECT ggp_role, ggp_id_group FROM gems__groups WHERE ggp_group_active=1 AND ggp_staff_members=1 ORDER BY ggp_name');
     $current = null;
     foreach (array_reverse($this->acl->getRoles()) as $roleId) {
         if (isset($roles[$roleId], $groups[$roles[$roleId]])) {
             if ($current) {
                 if ($this->acl->inheritsRole($current, $roleId)) {
                     $current = $roleId;
                 }
             } else {
                 $current = $roleId;
             }
         }
     }
     if (isset($roles[$current])) {
         return $roles[$current];
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:20,代码来源:DbLookup.php


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