mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
fix: better applicable check for updating external mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
c14948f629
commit
be3bbf22e0
1 changed files with 18 additions and 2 deletions
|
|
@ -194,10 +194,26 @@ class MountCacheService implements IEventListener {
|
|||
);
|
||||
}
|
||||
|
||||
private function isApplicableForUser(StorageConfig $storage, IUser $user): bool {
|
||||
if (count($storage->getApplicableUsers()) + count($storage->getApplicableGroups()) === 0) {
|
||||
return true;
|
||||
}
|
||||
if (in_array($user->getUID(), $storage->getApplicableUsers())) {
|
||||
return true;
|
||||
}
|
||||
$groupIds = $this->groupManager->getUserGroupIds($user);
|
||||
foreach ($groupIds as $groupId) {
|
||||
if (in_array($groupId, $storage->getApplicableGroups())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function handleUserRemoved(IGroup $group, IUser $user): void {
|
||||
$storages = $this->storagesService->getAllStoragesForGroup($group);
|
||||
foreach ($storages as $storage) {
|
||||
if (!in_array($user->getUID(), $storage->getApplicableUsers())) {
|
||||
if (!$this->isApplicableForUser($storage, $user)) {
|
||||
$this->userMountCache->removeMount($storage->getMountPointForUser($user));
|
||||
}
|
||||
}
|
||||
|
|
@ -214,7 +230,7 @@ class MountCacheService implements IEventListener {
|
|||
$storages = $this->storagesService->getAllStoragesForGroup($group);
|
||||
foreach ($storages as $storage) {
|
||||
foreach ($group->searchUsers('') as $user) {
|
||||
if (!in_array($user->getUID(), $storage->getApplicableUsers())) {
|
||||
if (!$this->isApplicableForUser($storage, $user)) {
|
||||
$this->userMountCache->removeMount($storage->getMountPointForUser($user));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue