From c07d4905b3339ea4c5ff71fb82b3b0c1c36699f8 Mon Sep 17 00:00:00 2001 From: Ferdinand Frost Date: Mon, 4 Sep 2023 23:31:25 +0200 Subject: [PATCH] move Adapter implementations into fal Layer, remove api composer dependency - Fairway API is acts now as independend Base or common Interface --- composer.json | 4 +- src/Adapter/CantoAdapter/CantoFile.php | 72 ---- src/Adapter/CantoAdapter/CantoIdentifier.php | 55 --- src/Adapter/CantoAdapter/CantoPermission.php | 70 ---- src/Adapter/CantoAdapter/Driver.php | 335 ------------------ src/Adapter/PixelboxxAdapter/Directory.php | 61 ---- src/Adapter/PixelboxxAdapter/Driver.php | 235 ------------ .../PixelboxxAdapter/PixelboxxClient.php | 59 --- .../PixelboxxAdapter/PixelboxxFile.php | 66 ---- .../PixelboxxAdapter/PixelboxxPermission.php | 50 --- 10 files changed, 1 insertion(+), 1006 deletions(-) delete mode 100644 src/Adapter/CantoAdapter/CantoFile.php delete mode 100644 src/Adapter/CantoAdapter/CantoIdentifier.php delete mode 100644 src/Adapter/CantoAdapter/CantoPermission.php delete mode 100644 src/Adapter/CantoAdapter/Driver.php delete mode 100644 src/Adapter/PixelboxxAdapter/Directory.php delete mode 100644 src/Adapter/PixelboxxAdapter/Driver.php delete mode 100644 src/Adapter/PixelboxxAdapter/PixelboxxClient.php delete mode 100644 src/Adapter/PixelboxxAdapter/PixelboxxFile.php delete mode 100644 src/Adapter/PixelboxxAdapter/PixelboxxPermission.php diff --git a/composer.json b/composer.json index febfd02..99e0971 100644 --- a/composer.json +++ b/composer.json @@ -18,9 +18,7 @@ "require": { "php": "^7.4 || ^8.0", "ext-json": "*", - "guzzlehttp/guzzle": "^7.4", - "fairway/canto-saas-api": "*", - "fairway/pixelboxx-saas-api": "*" + "guzzlehttp/guzzle": "^7.4" }, "require-dev": { "phpunit/phpunit": "^9.5", diff --git a/src/Adapter/CantoAdapter/CantoFile.php b/src/Adapter/CantoAdapter/CantoFile.php deleted file mode 100644 index 7afa7c0..0000000 --- a/src/Adapter/CantoAdapter/CantoFile.php +++ /dev/null @@ -1,72 +0,0 @@ -getMetadata()['default']['Name']; - } - - public function getCantoIdentifier(): CantoIdentifier - { - return new CantoIdentifier($this->identifier); - } - - public function getScheme(): string - { - return $this->getCantoIdentifier()->getScheme(); - } - - public function getIdentifier(): string - { - return $this->getCantoIdentifier()->getIdentifier(); - } - - public function getPublicUrl(): string - { - return ''; - } - - /** - * does not have last access time, thus setting it to last modified time - */ - public function getATime(): int - { - return $this->getMTime(); - } - - public function getMTime(): int - { - return DateTime::createFromFormat( - 'YmdHisv', - $this->getMetadata()['default']['Date modified'] - )->getTimestamp(); - } - - public function getCTime(): int - { - return DateTime::createFromFormat( - 'YmdHisv', - $this->getMetadata()['default']['Date uploaded'] - )->getTimestamp(); - } - - public function getExtension(): string - { - return $this->getMetadata()['metadata']['File Type Extension']; - } -} diff --git a/src/Adapter/CantoAdapter/CantoIdentifier.php b/src/Adapter/CantoAdapter/CantoIdentifier.php deleted file mode 100644 index a485c4b..0000000 --- a/src/Adapter/CantoAdapter/CantoIdentifier.php +++ /dev/null @@ -1,55 +0,0 @@ -'; - private string $identifier; - - public function __construct(string $identifier) - { - $this->identifier = $identifier; - } - - public static function buildIdentifier(string $scheme, string $identifier): self - { - return new self(sprintf('%s%s%s', $scheme, self::SPLIT_IDENTIFIER, $identifier)); - } - - public function getScheme(): string - { - return $this->split()['scheme']; - } - - public function getIdentifier(): string - { - return $this->split()['identifier']; - } - - #[ArrayShape(['scheme' => 'string', 'identifier' => 'string'])] - private function split(): array - { - [$scheme, $identifier] = explode(self::SPLIT_IDENTIFIER, $this->identifier); - return [ - 'scheme' => $scheme, - 'identifier' => $identifier, - ]; - } - - public function __toString(): string - { - return $this->identifier; - } -} diff --git a/src/Adapter/CantoAdapter/CantoPermission.php b/src/Adapter/CantoAdapter/CantoPermission.php deleted file mode 100644 index a745e71..0000000 --- a/src/Adapter/CantoAdapter/CantoPermission.php +++ /dev/null @@ -1,70 +0,0 @@ -parseIdentifier($this->identifier); - $type = 'file'; - if (in_array($cantoId->getScheme(), [GetDetailsRequest::TYPE_ALBUM, GetDetailsRequest::TYPE_FOLDER], true)) { - $type = $cantoId->getScheme(); - } - return [ - GetDetailsRequest::TYPE_ALBUM => [ - Permission::ACTION_CREATE_FILE => true, - Permission::ACTION_UPDATE_FILE => true, - Permission::ACTION_COPY_FILE => true, - Permission::ACTION_MOVE_FILE => true, - Permission::ACTION_DELETE_FILE => true, - Permission::ACTION_CREATE_FOLDER => false, - Permission::ACTION_UPDATE_FOLDER => false, - Permission::ACTION_COPY_FOLDER => false, - Permission::ACTION_MOVE_FOLDER => false, - Permission::ACTION_DELETE_FOLDER => false, - ], - GetDetailsRequest::TYPE_FOLDER => [ - Permission::ACTION_CREATE_FILE => false, - Permission::ACTION_UPDATE_FILE => false, - Permission::ACTION_COPY_FILE => false, - Permission::ACTION_MOVE_FILE => false, - Permission::ACTION_DELETE_FILE => false, - Permission::ACTION_CREATE_FOLDER => true, - Permission::ACTION_UPDATE_FOLDER => true, - Permission::ACTION_COPY_FOLDER => false, // copying and moving of folders and albums not supported yet - Permission::ACTION_MOVE_FOLDER => false, - Permission::ACTION_DELETE_FOLDER => true, - ], - 'file' => [ - Permission::ACTION_CREATE_FILE => true, - Permission::ACTION_UPDATE_FILE => true, - Permission::ACTION_COPY_FILE => true, - Permission::ACTION_MOVE_FILE => true, - Permission::ACTION_DELETE_FILE => true, - Permission::ACTION_CREATE_FOLDER => false, - Permission::ACTION_UPDATE_FOLDER => false, - Permission::ACTION_COPY_FOLDER => false, - Permission::ACTION_MOVE_FOLDER => false, - Permission::ACTION_DELETE_FOLDER => false, - ], - ][$type][$action] ?? false; - } - - private function parseIdentifier(string $identifier): CantoIdentifier - { - return new CantoIdentifier($identifier); - } -} diff --git a/src/Adapter/CantoAdapter/Driver.php b/src/Adapter/CantoAdapter/Driver.php deleted file mode 100644 index a8b8b41..0000000 --- a/src/Adapter/CantoAdapter/Driver.php +++ /dev/null @@ -1,335 +0,0 @@ -client = $client; - if ($this->client->getAccessToken() === null) { - $this->client->authorizeWithClientCredentials($userId); - } - } - - public function hasAssetPicker(): bool - { - return true; - } - - public function getAssetPicker(): string - { - return ''; - } - - public function getFile(string $identifier): CantoFile - { - return new CantoFile($this, $identifier); - } - - public function getMetadata(string $identifier): array - { - if ($this->getType($identifier) === FileType::DIRECTORY) { - // todo: Exception type needs to be defined - throw new \Exception('Not supported'); - } - $parsedIdentifier = $this->parseIdentifier($identifier); - return $this->client->asset()->getContentDetails( - (new GetContentDetailsRequest($parsedIdentifier->getIdentifier(), $parsedIdentifier->getScheme())) - )->getResponseData(); - } - - public function exists(string $identifier, string $type): bool - { - try { - $parsedIdentifier = $this->parseIdentifier($identifier); - $this->client->asset()->getContentDetails( - (new GetContentDetailsRequest($parsedIdentifier->getIdentifier(), $parsedIdentifier->getScheme())) - ); - } catch (Exception $exception) { - if (str_contains($exception->getMessage(), '404')) { - return false; - } - throw $exception; - } - return true; - } - - public function getType(string $identifier): string - { - $scheme = $this->parseIdentifier($identifier)->getScheme(); - if ($scheme === GetDetailsRequest::TYPE_ALBUM || $scheme === GetDetailsRequest::TYPE_FOLDER) { - return FileType::DIRECTORY; - } - return FileType::FILE; - } - - public function read(string $identifier): string - { - $parsedIdentifier = $this->parseIdentifier($identifier); - $download2 = sprintf( - 'https://%s.%s/api_binary/v1/%s/%s', - $this->client->getOptions()->getCantoName(), - $this->client->getOptions()->getCantoDomain(), - $parsedIdentifier->getScheme(), - $parsedIdentifier->getIdentifier() - ); - return $this->client->asset()->getAuthorizedUrlContent($download2)->getBody()->getContents(); - } - - public function listDirectory(string $identifier = null): DirectoryIterator - { - if ($identifier === null) { - throw new NotImplementedException('The root folder needs to be implemented'); - } - $id = $this->parseIdentifier($identifier); - if ($id->getScheme() === GetDetailsRequest::TYPE_FOLDER) { - $request = new GetTreeRequest($id->getIdentifier()); - $response = $this->client->libraryTree()->getTree($request); - return new DirectoryIterator($response->getResults()); - } - $result = []; - $request = new ListAlbumContentRequest($id->getIdentifier()); - $request->setLimit(100); - $count = 0; - do { - $request->setStart($count); - $response = $this->client->libraryTree()->listAlbumContent($request); - $found = $response->getFound(); - $count += count($response->getResults()); - $result = [...$result, ...$response->getResults()]; - } while ($found > $count); - return new DirectoryIterator($result); - } - - public function lastModified(string $identifier): int - { - return (int)$this->getMetadata($identifier)['default']['Date modified']; - } - - public function size(string $identifier): int - { - return $this->getMetadata($identifier)['default']['Size']; - } - - public function count(string $identifier): int - { - $id = $this->parseIdentifier($identifier); - if ($id->getScheme() === GetDetailsRequest::TYPE_FOLDER) { - $request = new GetTreeRequest($id->getIdentifier()); - $response = $this->client->libraryTree()->getTree($request); - return count($response->getResults()); - } - $request = new ListAlbumContentRequest($id->getIdentifier()); - $response = $this->client->libraryTree()->listAlbumContent($request); - return $response->getFound(); - } - - public function mimeType(string $identifier): string - { - return $this->getMetadata($identifier)['default']['Content Type']; - } - - public function visibility(string $identifier): string - { - // todo: this needs to be refined, how are we going to implement visibility - return ''; - } - - public function getPermission(string $identifier): Permission - { - return new CantoPermission($identifier, true, true); - } - - /** - * After Uploading the file, the returned string is *not* the new identifier, it's the file name. - * @see Driver::getUploadStatus() the status of the current upload can be retrieved here. - */ - public function write(string $identifier, string $parentIdentifier, string $filePath, array $config = []): string - { - $request = new UploadFileRequest( - $filePath, - $this->client->upload()->getUploadSetting(new GetUploadSettingRequest(false)) - ); - // todo, check folder write permission - $request->setAlbumId($this->parseIdentifier($parentIdentifier)->getIdentifier()); - $request->setFileName((string)$identifier); - $this->client->upload()->uploadFile($request); - if (($config['remove_original'] ?? false) === true) { - unlink($filePath); - } - return $request->getFileName(); - } - - public function getUploadStatus(string $fileName): ?Status - { - $status = $this->client->upload()->queryUploadStatus(new QueryUploadStatusRequest()); - foreach ($status->getStatusItems() as $item) { - if ($item->name === $fileName) { - return $item; - } - } - return null; - } - - public function getIdentifierFromStatusObject(Status $status): ?CantoIdentifier - { - if ($status->status === Status::STATUS_DONE) { - return CantoIdentifier::buildIdentifier($status->scheme, $status->id); - } - return null; - } - - public function setVisibility(string $identifier): void - { - // TODO: Implement setVisibility() method. - } - - public function delete(string $identifier): void - { - $cantoId = $this->parseIdentifier($identifier); - if ($this->getType($identifier) === FileType::DIRECTORY) { - $request = new DeleteFolderOrAlbumRequest(); - $request->addFolder($cantoId->getIdentifier(), $cantoId->getScheme()); - $this->client->libraryTree()->deleteFolderOrAlbum($request)->isSuccessful(); - return; - } - $request = new BatchDeleteContentRequest(); - $request->addContent($cantoId->getScheme(), $cantoId->getIdentifier()); - $this->client->asset()->batchDeleteContent($request); - } - - public function create(string $identifier, string $parentIdentifier, array $config = []): string - { - $cantoId = $this->parseIdentifier($identifier); - if ($cantoId->getScheme() === GetDetailsRequest::TYPE_FOLDER) { - return $this->createFolder($cantoId->getIdentifier(), $parentIdentifier, $config); - } - if ($cantoId->getScheme() === GetDetailsRequest::TYPE_ALBUM) { - return $this->createAlbum($cantoId->getIdentifier(), $parentIdentifier, $config); - } - return $this->createFile($identifier, $parentIdentifier, $config); - } - - private function createAlbum(string $identifier, string $parentIdentifier, array $config = []): string - { - $request = new CreateAlbumFolderRequest($identifier); - $request->setParentFolder($this->parseIdentifier($parentIdentifier)->getIdentifier()); - return $this->client->libraryTree()->createAlbum($request)->getId(); - } - - private function createFolder(string $identifier, string $parentIdentifier, array $config = []): string - { - $request = new CreateAlbumFolderRequest($identifier); - $request->setParentFolder($this->parseIdentifier($parentIdentifier)->getIdentifier()); - return $this->client->libraryTree()->createFolder($request)->getId(); - } - - public function createFile(string $identifier, string $parentIdentifier, array $config = []): string - { - $path = '/tmp/' . $identifier; - touch($path); - $config = array_replace($config, ['remove_original' => true]); - return $this->write($identifier, $parentIdentifier, $path, $config); - } - - public function move(string $identifier, string $oldDestination, string $destination, array $config = []): void - { - if ($this->getType($identifier) === FileType::FILE) { - $this->copy($identifier, $destination, $config); - $this->client->asset()->removeContentsFromAlbum( - new RemoveContentFromAlbumRequest($this->parseIdentifier($oldDestination)->getIdentifier()) - ); - } - // todo: move directory - } - - public function copy(string $identifier, string $destination, array $config = []): void - { - if ($this->getType($identifier) === FileType::FILE) { - $file = $this->getFile($identifier); - $request = new AssignContentToAlbumRequest($this->parseIdentifier($destination)->getIdentifier()); - $request->addContent($file->getScheme(), $file->getIdentifier(), $file->getFileName()); - $this->client->asset()->assignContentToAlbum($request); - } - // todo: copy directory - } - - public function rename(string $identifier, string $newName, array $config = []): void - { - $cantoId = $this->parseIdentifier($identifier); - $request = new RenameContentRequest($cantoId->getScheme(), $cantoId->getIdentifier(), $newName); - $this->client->asset()->renameContent($request); - } - - public function replace(string $identifier, string $filePath, array $config = []): string - { - $cantoId = $this->parseIdentifier($identifier); - $request = new UploadFileRequest( - $filePath, - $this->client->upload()->getUploadSetting(new GetUploadSettingRequest(false)) - ); - $request->setScheme($cantoId->getScheme()); - $request->setMetaId($cantoId->getIdentifier()); - $this->client->upload()->uploadFile($request); - if (($config['remove_original'] ?? false) === true) { - unlink($filePath); - } - return $identifier; - } - - private function parseIdentifier(string $identifier): CantoIdentifier - { - return new CantoIdentifier($identifier); - } - - public function parentOfIdentifier(string $identifier): Directory - { - throw new \Exception('Not supported yet'); -// return new Directory(); - } - - public function getClient(): Client - { - return $this->client; - } - - public function getDriver(): DriverClient - { - throw new \Exception('Not supported yet'); - } -} diff --git a/src/Adapter/PixelboxxAdapter/Directory.php b/src/Adapter/PixelboxxAdapter/Directory.php deleted file mode 100644 index 4e4554d..0000000 --- a/src/Adapter/PixelboxxAdapter/Directory.php +++ /dev/null @@ -1,61 +0,0 @@ -folder = $folder; - $this->parent = $parent; - } - - public function getIdentifier(): string - { - if ($this->folder->getId()->getResourceId() === '0') { - return ''; - } - $parent = ''; - if ($this->parent) { - $parent = $this->parent->getIdentifier(); - } - return $parent . '/' . $this->folder->getId()->getResourceId(); - } - - public function getFileName(): string - { - return $this->folder->getName(); - } - - public function getATime(): int - { - return 0; - } - - public function getMTime(): int - { - return 0; - } - - public function getCTime(): int - { - return 0; - } - - public function getParentDirectory(): self - { - return $this->parent; - } -} diff --git a/src/Adapter/PixelboxxAdapter/Driver.php b/src/Adapter/PixelboxxAdapter/Driver.php deleted file mode 100644 index 6682a4d..0000000 --- a/src/Adapter/PixelboxxAdapter/Driver.php +++ /dev/null @@ -1,235 +0,0 @@ -client = $client; - } - - public function getClient(): Client - { - return $this->client; - } - - public function hasAssetPicker(): bool - { - return true; - } - - public function getAssetPicker(): string - { - throw new NotImplementedException(); - } - - public function getFile(string $identifier): File - { - return new PixelboxxFile($this, $identifier); - } - - public function getPublicUrl(string $identifier): string - { - return $this->client->assets()->getThumbnail($identifier)->getUrl(); - } - - public function getMetadata(string $identifier): array - { - if ($this->getType($identifier) === FileType::DIRECTORY) { - throw new NotSupportedException(); - } - /** @var MetadataGroup[] $metadataGroups */ - $metadataGroups = $this->client->assets()->getAsset($identifier, function (AssetMetadata $metadata) { - $metadata->setFull(true); - $metadata->setLocalizedValues(true); - $metadata->setAllMeta(true); - })->getAsset()->getMetadata(); - $metadata = []; - foreach ($metadataGroups as $metadataGroup) { - foreach ($metadataGroup->getProperties() as $property) { - // todo: There should be a metadata model - $metadata[] = $property; - } - } - return $metadata; - } - - public function exists(string $identifier, string $type): bool - { - if ($type === FileType::FILE) { - return $this->client->assets()->getAsset($identifier) !== null; - } - return $this->client->folders()->getFolderAssets($identifier) !== null; - } - - public function getType(string $identifier): string - { - try { - $identifier = new PixelboxxResourceName($identifier); - } catch (Exception $exception) { - throw new NotSupportedException('Identifier is not supported'); - } - if ($identifier->getResourceType() === PixelboxxResourceName::FOLDER) { - return FileType::DIRECTORY; - } - if ($identifier->getResourceType() === PixelboxxResourceName::ASSET) { - return FileType::FILE; - } - throw new NotSupportedException(sprintf('File-Type %s is not supported', $identifier->getResourceType())); - } - - public function read(string $identifier): string - { - return $this->client->assets()->downloadAsset($identifier)->getContent(); - } - - public function listDirectory(string $identifier = null, bool $recursive = false): DirectoryIterator - { - $structure = $this->client->folders()->getFolderStructure($identifier); - $directories = []; - if ($structure !== null) { - $this->flattenDirectoryStructure($structure->getFolder(), $directories, null, $recursive); - } - return new DirectoryIterator($directories); - } - - public function getDirectory(string $identifier = null): ?Directory - { - $folder = $this->client->folders()->getFolderStructure($identifier); - if ($folder === null) { - return null; - } - return new Directory($folder->getFolder()); - } - - private function flattenDirectoryStructure(Folder $folder, array &$directories, Directory $parent = null, bool $recursive = false): void - { - $parentDirectory = new Directory($folder, $parent); - foreach ($folder->getChildFolders() as $childFolder) { - $directories[] = new Directory($childFolder, $parentDirectory); - if ($recursive) { - $this->flattenDirectoryStructure($childFolder, $directories, $parentDirectory, $recursive); - } - } - } - - public function lastModified(string $identifier): int - { - $metadata = $this->client->assets()->getAsset($identifier)->getAsset()->getMetadataByPropertyId('versiondate'); - return PixelboxxUtility::buildTimestamp($metadata->getValue()); - } - - public function size(string $identifier): int - { - $metadata = $this->client->assets()->getAsset($identifier)->getAsset()->getMetadataByPropertyId('filesize'); - return (int)$metadata->getValue(); - } - - public function count(string $identifier): int - { - if ($this->getType($identifier) === FileType::FILE) { - throw new NotSupportedException('The type File cannot be counted'); - } - $folder = $this->client->folders()->getFolderStructure($identifier); - return $folder === null ? 0 : $folder->getCount(); - } - - public function mimeType(string $identifier): string - { - $metadata = $this->client->assets()->getAsset($identifier)->getAsset()->getMetadataByPropertyId('type'); - return $metadata->getValue(); - } - - public function visibility(string $identifier): string - { - // todo: this needs to be refined, how are we going to implement visibility - return ''; - } - - public function getPermission(string $identifier): Permission - { - return new PixelboxxPermission($identifier, true, true); - } - - public function write(string $identifier, string $parentIdentifier, string $filePath, array $config = []): string - { - throw new NotImplementedException(); - } - - public function setVisibility(string $identifier): void - { - throw new NotImplementedException(); - } - - public function delete(string $identifier): void - { - throw new NotImplementedException(); - } - - public function create(string $identifier, string $parentIdentifier, array $config = []): string - { - throw new NotImplementedException(); - } - - public function move(string $identifier, string $oldDestination, string $destination, array $config = []): void - { - throw new NotImplementedException(); - } - - public function copy(string $identifier, string $destination, array $config = []): void - { - throw new NotImplementedException(); - } - - public function rename(string $identifier, string $newName, array $config = []): void - { - throw new NotImplementedException(); - } - - public function replace(string $identifier, string $filePath, array $config = []): string - { - throw new NotImplementedException(); - } - - public function parentOfIdentifier(string $identifier): DirectoryIterator - { - $file = $this->getClient()->assets()->getAsset($identifier)->getAsset(); - $directories = []; - foreach ($file->getContainingFolders() as $parentFolder) { - $directories[] = $this->getDirectory((string)$parentFolder); - } - return new DirectoryIterator($directories); - } - - public function getDriver(): DriverClient - { - return $this; - } -} diff --git a/src/Adapter/PixelboxxAdapter/PixelboxxClient.php b/src/Adapter/PixelboxxAdapter/PixelboxxClient.php deleted file mode 100644 index fe550dd..0000000 --- a/src/Adapter/PixelboxxAdapter/PixelboxxClient.php +++ /dev/null @@ -1,59 +0,0 @@ -baseUrl = $baseUrl; - $this->configuration = $configuration; - } - - public function authenticate(string $username, string $password) - { - $client = new Client($this->configuration); - $response = $client->post( - $this->getEndpoint('/authenticate/login'), - [ - 'auth' => [ - $username, - $password - ] - ] - ); - } - - private function getConfiguration(): array - { - return array_merge($this->defaultConfiguration, $this->configuration); - } - - public function setConfiguration(array $configuration): self - { - $this->configuration = $configuration; - return $this; - } - - public function getEndpoint(string $endpoint): string - { - return sprintf('%s%s', rtrim($this->baseUrl, '/'), $endpoint); - } -} diff --git a/src/Adapter/PixelboxxAdapter/PixelboxxFile.php b/src/Adapter/PixelboxxAdapter/PixelboxxFile.php deleted file mode 100644 index 8eae3eb..0000000 --- a/src/Adapter/PixelboxxAdapter/PixelboxxFile.php +++ /dev/null @@ -1,66 +0,0 @@ -asset !== null) { - return $this->asset; - } - /** @var Client $client */ - $client = $this->client->getClient(); - $this->asset = $client->assets()->getAsset($this->identifier)->getAsset(); - return $this->asset; - } - - public function getFileName(): string - { - return $this->getAsset()->getName(); - } - - public function getATime(): int - { - return PixelboxxUtility::buildTimestamp($this->getAsset()->getCreated()); - } - - public function getMTime(): int - { - return PixelboxxUtility::buildTimestamp($this->getAsset()->getCreated()); - } - - public function getCTime(): int - { - return PixelboxxUtility::buildTimestamp($this->getAsset()->getCreated()); - } - - public function getExtension(): string - { - return $this->getAsset()->getAssetType(); - } -} diff --git a/src/Adapter/PixelboxxAdapter/PixelboxxPermission.php b/src/Adapter/PixelboxxAdapter/PixelboxxPermission.php deleted file mode 100644 index 2a58570..0000000 --- a/src/Adapter/PixelboxxAdapter/PixelboxxPermission.php +++ /dev/null @@ -1,50 +0,0 @@ -identifier); - if ($prn->getResourceType() === PixelboxxResourceName::ASSET) { - return [ - Permission::ACTION_CREATE_FILE => true, - Permission::ACTION_UPDATE_FILE => true, - Permission::ACTION_COPY_FILE => true, - Permission::ACTION_MOVE_FILE => true, - Permission::ACTION_DELETE_FILE => true, - Permission::ACTION_CREATE_FOLDER => false, - Permission::ACTION_UPDATE_FOLDER => false, - Permission::ACTION_COPY_FOLDER => false, - Permission::ACTION_MOVE_FOLDER => false, - Permission::ACTION_DELETE_FOLDER => false, - ][$action] ?? false; - } - if ($prn->getResourceType() === PixelboxxResourceName::FOLDER) { - return [ - Permission::ACTION_CREATE_FILE => true, - Permission::ACTION_UPDATE_FILE => true, - Permission::ACTION_COPY_FILE => true, - Permission::ACTION_MOVE_FILE => true, - Permission::ACTION_DELETE_FILE => true, - Permission::ACTION_CREATE_FOLDER => true, - Permission::ACTION_UPDATE_FOLDER => true, - Permission::ACTION_COPY_FOLDER => true, - Permission::ACTION_MOVE_FOLDER => true, - Permission::ACTION_DELETE_FOLDER => true, - ][$action] ?? false; - } - return false; - } -}