]> source.dussan.org Git - nextcloud-server.git/commitdiff
The privacy setting is only about syncing to other servers
authorJoas Schilling <coding@schilljs.com>
Thu, 3 Sep 2020 13:46:21 +0000 (15:46 +0200)
committerJoas Schilling <coding@schilljs.com>
Thu, 3 Sep 2020 13:46:21 +0000 (15:46 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
core/Controller/AvatarController.php
tests/Core/Controller/AvatarControllerTest.php

index dc6febc467fbeca3f173755ec0c72e62014444dd..cbcb9783680f8c77ff9651a451b98315e0d8cd19 100644 (file)
@@ -126,21 +126,6 @@ class AvatarController extends Controller {
                        $size = 64;
                }
 
-               $user = $this->userManager->get($userId);
-               if ($user === null) {
-                       return new JSONResponse([], Http::STATUS_NOT_FOUND);
-               }
-
-               $account = $this->accountManager->getAccount($user);
-               $scope = $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope();
-
-               if ($scope !== IAccountManager::VISIBILITY_PUBLIC && $this->userId === null) {
-                       // Public avatar access is not allowed
-                       $response = new JSONResponse([], Http::STATUS_NOT_FOUND);
-                       $response->cacheFor(1800);
-                       return $response;
-               }
-
                try {
                        $avatar = $this->avatarManager->getAvatar($userId);
                        $avatarFile = $avatar->getFile($size);
index f070897e1b1f8dd13d775603f5e59d88cff0ad2e..678648fa17669c1fdd70822a8ee631e53282be9c 100644 (file)
@@ -145,39 +145,6 @@ class AvatarControllerTest extends \Test\TestCase {
                $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus());
        }
 
-       public function testAvatarNotPublic() {
-               $account = $this->createMock(IAccount::class);
-               $this->accountManager->method('getAccount')
-                       ->with($this->userMock)
-                       ->willReturn($account);
-
-               $property = $this->createMock(IAccountProperty::class);
-               $account->method('getProperty')
-                       ->with(IAccountManager::PROPERTY_AVATAR)
-                       ->willReturn($property);
-
-               $property->method('getScope')
-                       ->willReturn(IAccountManager::VISIBILITY_PRIVATE);
-
-               $controller = new AvatarController(
-                       'core',
-                       $this->request,
-                       $this->avatarManager,
-                       $this->cache,
-                       $this->l,
-                       $this->userManager,
-                       $this->rootFolder,
-                       $this->logger,
-                       null,
-                       $this->timeFactory,
-                       $this->accountManager
-               );
-
-               $result = $controller->getAvatar('userId', 128);
-
-               $this->assertEquals(Http::STATUS_NOT_FOUND, $result->getStatus());
-       }
-
        /**
         * Fetch the user's avatar
         */