Exemple #1
0
 public function testSetRoleAccessWithRoleName()
 {
     $acl = new LeanACL();
     $acl->setRoleReadAccess("admin", true);
     $out = $acl->encode();
     $this->assertEquals(true, $out["role:admin"]["read"]);
     $acl->setRoleWriteAccess("admin", false);
     $out = $acl->encode();
     $this->assertEquals(false, $out["role:admin"]["write"]);
 }
Exemple #2
0
 public function testInitializeRole()
 {
     $acl = new LeanACL();
     $acl->setPublicWriteAccess(true);
     // so it can be destroyed
     $role = new LeanRole("guest", $acl);
     $role->save();
     $this->assertNotEmpty($role->getObjectId());
     $childrenUsers = $role->getUsers();
     $this->assertTrue($childrenUsers instanceof LeanRelation);
     $childrenRoles = $role->getRoles();
     $this->assertTrue($childrenRoles instanceof LeanRelation);
     $role->destroy();
 }