diff --git a/Classes/Domain/Model/BackendUser.php b/Classes/Domain/Model/BackendUser.php index 367fff6..0c3b84c 100644 --- a/Classes/Domain/Model/BackendUser.php +++ b/Classes/Domain/Model/BackendUser.php @@ -62,19 +62,25 @@ public function getInheritedMountPoints(): array /** * @param \KoninklijkeCollective\MyUserManagement\Domain\Model\BackendUserGroup $group * @param array $mounts + * @param array $groups * @return array */ - protected function getAllDatabaseMountsFromUserGroup(BackendUserGroup $group, array $mounts = []): array + protected function getAllDatabaseMountsFromUserGroup(BackendUserGroup $group, array $mounts = [], array $groups = []): array { $dbMounts = $group->getDatabaseMountPoints(); if (is_array($dbMounts)) { $mounts = array_unique(array_merge($mounts, $dbMounts)); } + // Stock group UIDs to prevent infinite loop in case of subgroup circular references. + $groups[] = $group->getUid(); + if ($group->getSubGroups() !== null) { foreach ($group->getSubGroups() as $subGroup) { - /** @var \KoninklijkeCollective\MyUserManagement\Domain\Model\BackendUserGroup $subGroup */ - $mounts = $this->getAllDatabaseMountsFromUserGroup($subGroup, $mounts); + if (!in_array($subGroup->getUid(), $groups, true)) { + /** @var \KoninklijkeCollective\MyUserManagement\Domain\Model\BackendUserGroup $subGroup */ + $mounts = $this->getAllDatabaseMountsFromUserGroup($subGroup, $mounts, $groups); + } } }