aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Avatar
diff options
context:
space:
mode:
authorPytal <24800714+Pytal@users.noreply.github.com>2022-06-08 16:27:31 -0700
committerGitHub <noreply@github.com>2022-06-08 16:27:31 -0700
commite76d8bb901a50b68e94e39a9f1353a8d06fc37a5 (patch)
treed87acb6462dc93a3cc2d9fccd9636effbf149b68 /lib/private/Avatar
parentde6b0dadbe5190325d0507ba1438880d772d8a8a (diff)
parent7c50dd888edb4d4a3ab4f132c628070fd3b8b8ac (diff)
downloadnextcloud-server-e76d8bb901a50b68e94e39a9f1353a8d06fc37a5.tar.gz
nextcloud-server-e76d8bb901a50b68e94e39a9f1353a8d06fc37a5.zip
Merge pull request #32697 from nextcloud/fix/get-avatar-authz
Diffstat (limited to 'lib/private/Avatar')
-rw-r--r--lib/private/Avatar/AvatarManager.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/private/Avatar/AvatarManager.php b/lib/private/Avatar/AvatarManager.php
index 77138085dc9..ec9bed40850 100644
--- a/lib/private/Avatar/AvatarManager.php
+++ b/lib/private/Avatar/AvatarManager.php
@@ -136,20 +136,23 @@ class AvatarManager implements IAvatarManager {
$avatarScope = '';
}
- if (
+ switch ($avatarScope) {
// v2-private scope hides the avatar from public access and from unknown users
- $avatarScope === IAccountManager::SCOPE_PRIVATE
- && (
- // accessing from public link
- $requestingUser === null
- // logged in, but unknown to user
- || !$this->knownUserService->isKnownToUser($requestingUser->getUID(), $userId)
- )) {
- // use a placeholder avatar which caches the generated images
- return new PlaceholderAvatar($folder, $user, $this->logger);
+ case IAccountManager::SCOPE_PRIVATE:
+ if ($requestingUser !== null && $this->knownUserService->isKnownToUser($requestingUser->getUID(), $userId)) {
+ return new UserAvatar($folder, $this->l, $user, $this->logger, $this->config);
+ }
+ break;
+ case IAccountManager::SCOPE_LOCAL:
+ case IAccountManager::SCOPE_FEDERATED:
+ case IAccountManager::SCOPE_PUBLISHED:
+ return new UserAvatar($folder, $this->l, $user, $this->logger, $this->config);
+ default:
+ // use a placeholder avatar which caches the generated images
+ return new PlaceholderAvatar($folder, $user, $this->logger);
}
- return new UserAvatar($folder, $this->l, $user, $this->logger, $this->config);
+ return new PlaceholderAvatar($folder, $user, $this->logger);
}
/**