Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Make sure to clone the original personal role before overriding.
Browse files Browse the repository at this point in the history
Re-apply specific "Shared" roles after clearing parent user's ACLs in case of a shared user.
  • Loading branch information
cdujeu committed Apr 15, 2014
1 parent 0f1ec52 commit f9ff1b7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/src/plugins/core.conf/class.AbstractAjxpUser.php
Expand Up @@ -386,7 +386,7 @@ public function recomputeMergedRole()
throw new Exception("Empty role, this is not normal");
}
uksort($this->roles, array($this, "orderRoles"));
$this->mergedRole = $this->roles[array_shift(array_keys($this->roles))];
$this->mergedRole = clone $this->roles[array_shift(array_keys($this->roles))];
if (count($this->roles) > 1) {
$this->parentRole = $this->mergedRole;
}
Expand All @@ -405,8 +405,12 @@ public function recomputeMergedRole()
$stretchedParentUserRole = AuthService::limitedRoleFromParent($this->parentUser);
if ($stretchedParentUserRole !== null) {
$this->parentRole = $this->parentRole->override($stretchedParentUserRole);
// REAPPLY SPECIFIC "SHARED" ROLES
foreach ($this->roles as $role) {
if(! $role->autoAppliesTo("shared")) continue;
$this->parentRole = $role->override($this->parentRole);
}
}

$this->mergedRole = $this->parentRole->override($this->personalRole);
}
}
Expand Down

0 comments on commit f9ff1b7

Please sign in to comment.