diff --git a/core/src/plugins/core.conf/class.AbstractAjxpUser.php b/core/src/plugins/core.conf/class.AbstractAjxpUser.php index 7be8e7edc8..7cc037e58c 100644 --- a/core/src/plugins/core.conf/class.AbstractAjxpUser.php +++ b/core/src/plugins/core.conf/class.AbstractAjxpUser.php @@ -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; } @@ -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); } }