albumMapper->deleteUserFromAlbumCollaboratorsList($this->userId, $this->album->getAlbum()->getId()); } /** * @return void */ public function setName($name) { throw new Forbidden('Not allowed to rename a shared album'); } protected function addFile(int $sourceId, string $ownerUID): bool { if (in_array($sourceId, $this->album->getFileIds())) { throw new Conflict("File $sourceId is already in the folder"); } if (!$this->albumMapper->isCollaborator($this->album->getAlbum()->getId(), $this->userId)) { return false; } $this->albumMapper->addFile($this->album->getAlbum()->getId(), $sourceId, $ownerUID); return true; } /** * Return only the owner, and do not reveal other collaborators. */ public function getCollaborators(): array { return [[ 'nc:collaborator' => [ 'id' => $this->album->getAlbum()->getUserId(), 'label' => $this->userManager->get($this->album->getAlbum()->getUserId())->getDisplayName(), 'type' => $this->album->getAlbum()->getReceivedFrom(), ], ]]; } public function setCollaborators($collaborators): array { throw new Forbidden('Not allowed to collaborators to a public album'); } }