diff options
author | Louis Chemineau <louis@chmn.me> | 2022-09-29 00:20:53 +0300 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2022-10-20 13:03:41 +0300 |
commit | defdb69026e9ef700bda4b4bba14f05e8eab5b8b (patch) | |
tree | 832ad9afd6de0f7f07d10e409c98a47d9473c752 /lib/Sabre/PhotosHome.php | |
parent | 01f33ad7b5a3235369a39744c6a33c06dec40f0f (diff) |
Make public pages work
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'lib/Sabre/PhotosHome.php')
-rw-r--r-- | lib/Sabre/PhotosHome.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/Sabre/PhotosHome.php b/lib/Sabre/PhotosHome.php index 97106c44..fc2e6b4c 100644 --- a/lib/Sabre/PhotosHome.php +++ b/lib/Sabre/PhotosHome.php @@ -26,10 +26,9 @@ namespace OCA\Photos\Sabre; use OCA\Photos\Album\AlbumMapper; use OCA\Photos\Sabre\Album\AlbumsHome; use OCA\Photos\Sabre\Album\SharedAlbumsHome; -use OCA\Photos\Sabre\Album\PublicAlbumsHome; use OCA\Photos\Service\UserConfigService; use OCP\Files\IRootFolder; -use OCP\IUser; +use OCP\IUserManager; use OCP\IGroupManager; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; @@ -38,23 +37,26 @@ use Sabre\DAV\ICollection; class PhotosHome implements ICollection { private AlbumMapper $albumMapper; private array $principalInfo; - private IUser $user; + private string $userId; private IRootFolder $rootFolder; + private IUserManager $userManager; private IGroupManager $groupManager; private UserConfigService $userConfigService; public function __construct( array $principalInfo, AlbumMapper $albumMapper, - IUser $user, + string $userId, IRootFolder $rootFolder, + IUserManager $userManager, IGroupManager $groupManager, UserConfigService $userConfigService ) { $this->principalInfo = $principalInfo; $this->albumMapper = $albumMapper; - $this->user = $user; + $this->userId = $userId; $this->rootFolder = $rootFolder; + $this->userManager = $userManager; $this->groupManager = $groupManager; $this->userConfigService = $userConfigService; } @@ -92,11 +94,9 @@ class PhotosHome implements ICollection { public function getChild($name) { switch ($name) { case AlbumsHome::NAME: - return new AlbumsHome($this->principalInfo, $this->albumMapper, $this->user, $this->rootFolder, $this->userConfigService); + return new AlbumsHome($this->principalInfo, $this->albumMapper, $this->userId, $this->rootFolder, $this->userConfigService); case SharedAlbumsHome::NAME: - return new SharedAlbumsHome($this->principalInfo, $this->albumMapper, $this->user, $this->rootFolder, $this->groupManager, $this->userConfigService); - case PublicAlbumsHome::NAME: - return new PublicAlbumsHome($this->principalInfo, $this->albumMapper, $this->user, $this->rootFolder, $this->userConfigService); + return new SharedAlbumsHome($this->principalInfo, $this->albumMapper, $this->userId, $this->rootFolder, $this->userManager, $this->groupManager, $this->userConfigService); } throw new NotFound(); @@ -107,14 +107,13 @@ class PhotosHome implements ICollection { */ public function getChildren(): array { return [ - new AlbumsHome($this->principalInfo, $this->albumMapper, $this->user, $this->rootFolder, $this->userConfigService), - new SharedAlbumsHome($this->principalInfo, $this->albumMapper, $this->user, $this->rootFolder, $this->groupManager, $this->userConfigService), - new PublicAlbumsHome($this->principalInfo, $this->albumMapper, $this->user, $this->rootFolder, $this->userConfigService), + new AlbumsHome($this->principalInfo, $this->albumMapper, $this->userId, $this->rootFolder, $this->userConfigService), + new SharedAlbumsHome($this->principalInfo, $this->albumMapper, $this->userId, $this->rootFolder, $this->userManager, $this->groupManager, $this->userConfigService), ]; } public function childExists($name): bool { - return $name === AlbumsHome::NAME || $name === SharedAlbumsHome::NAME || $name === PublicAlbumsHome::NAME; + return $name === AlbumsHome::NAME || $name === SharedAlbumsHome::NAME; } public function getLastModified(): int { |