Skip to content

Commit

Permalink
Matrix: transferred the responsibility for checking for grantees to c…
Browse files Browse the repository at this point in the history
…ancelGrantsFrom()
  • Loading branch information
JoshyPHP committed Dec 3, 2014
1 parent ca53ae5 commit 3c9d2d8
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/Matrix.php
Expand Up @@ -199,11 +199,7 @@ protected function applyRequireRule($srcAction, $trgAction)
{
$this->acl[$srcAction][$k] = $this->acl[$trgAction][$k];
$revoked = true;

if (isset($this->grantees[$srcAction][$k]))
{
$this->cancelGrantsFrom($srcAction, $k);
}
$this->cancelGrantsFrom($srcAction, $k);
}
}

Expand Down Expand Up @@ -252,11 +248,7 @@ protected function cancelGrant($srcAction, $k, $trgAction)
if (empty($this->grantors[$trgAction][$k]))
{
$this->acl[$trgAction][$k] = null;

if (isset($this->grantees[$trgAction][$k]))
{
$this->cancelGrantsFrom($trgAction, $k);
}
$this->cancelGrantsFrom($trgAction, $k);
}
}

Expand All @@ -271,6 +263,11 @@ protected function cancelGrant($srcAction, $k, $trgAction)
*/
protected function cancelGrantsFrom($srcAction, $k)
{
if (!isset($this->grantees[$srcAction][$k]))
{
return;
}

foreach ($this->grantees[$srcAction][$k] as $trgAction)
{
$this->cancelGrant($srcAction, $k, $trgAction);
Expand Down

0 comments on commit 3c9d2d8

Please sign in to comment.