Skip to content

Commit

Permalink
allow unsetting parentAcl on MutableAclInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
havvg committed Jan 30, 2012
1 parent 916597e commit dbd3a1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Security/Acl/Domain/Acl.php
Expand Up @@ -311,9 +311,9 @@ public function setEntriesInheriting($boolean)
/**
* {@inheritDoc}
*/
public function setParentAcl(AclInterface $acl)
public function setParentAcl(AclInterface $acl = null)
{
if (null === $acl->getId()) {
if (null !== $acl && null === $acl->getId()) {
throw new \InvalidArgumentException('$acl must have an ID.');
}

Expand Down
Expand Up @@ -114,9 +114,10 @@ function setEntriesInheriting($boolean);
/**
* Sets the parent ACL
*
* @param AclInterface $acl
* @param AclInterface|null $acl
* @return void
*/
function setParentAcl(AclInterface $acl);
function setParentAcl(AclInterface $acl = null);

/**
* Updates a class-based ACE
Expand Down
3 changes: 3 additions & 0 deletions tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php
Expand Up @@ -250,6 +250,9 @@ public function testSetGetParentAcl()
$this->assertNull($acl->getParentAcl());
$acl->setParentAcl($parentAcl);
$this->assertSame($parentAcl, $acl->getParentAcl());

$acl->setParentAcl(null);
$this->assertNull($acl->getParentAcl());
}

public function testSetIsEntriesInheriting()
Expand Down

0 comments on commit dbd3a1b

Please sign in to comment.