Example #1
0
 public function index01Action()
 {
     $aclObj = new Acl();
     $aclObj->addRole("member")->addRole("manager", "member")->addRole("admin", "manager");
     if ($aclObj->hasRole("member")) {
         echo "<h3 style='color:red;font-weight:bold'>OK</h3>";
     }
     $aclObj->removeRole("member");
     echo "<pre style='font-weight:bold'>";
     print_r($aclObj);
     echo "</pre>";
     return false;
 }
Example #2
0
 /**
  * Confirm that deleting a role after allowing access to all roles
  * raise undefined index error
  *
  * @group ZF-5700
  */
 public function testRemovingRoleAfterItWasAllowedAccessToAllResourcesGivesError()
 {
     $acl = new Acl\Acl();
     $acl->addRole(new Role\GenericRole('test0'));
     $acl->addRole(new Role\GenericRole('test1'));
     $acl->addRole(new Role\GenericRole('test2'));
     $acl->addResource(new Resource\GenericResource('Test'));
     $acl->allow(null, 'Test', 'xxx');
     // error test
     $acl->removeRole('test0');
     // Check after fix
     $this->assertFalse($acl->hasRole('test0'));
 }