Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-06-09 13:03:03 +0300
committerGitHub <noreply@github.com>2022-06-09 13:03:03 +0300
commit254cb7ad0cb2ebf31ca3124c48ef3de2b6e45e56 (patch)
tree3e6d13b01772e71c3914d8cf7dc723a1d23c3b38 /lib
parent7e819852ee436b4d3f4b10e46fcc46a8d1d25111 (diff)
parent887aa58905d5052f552cbf9a25dfa250b7513662 (diff)
Merge pull request #32770 from nextcloud/backport/32697/stable24
[stable24] Fix get avatar authorization
Diffstat (limited to 'lib')
-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);
}
/**