diff --git a/appinfo/info.xml b/appinfo/info.xml index 606c70d..7d87662 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -19,8 +19,10 @@ + OCA\OrganizationFolders\Command\OrganizationFolder\GetOrganizationFolder OCA\OrganizationFolders\Command\OrganizationFolder\ListOrganizationFolders OCA\OrganizationFolders\Command\OrganizationFolder\CreateOrganizationFolder + OCA\OrganizationFolders\Command\OrganizationFolder\RemoveOrganizationFolder OCA\OrganizationFolders\Command\Resource\CreateResource OCA\OrganizationFolders\Command\Resource\ListResources OCA\OrganizationFolders\Command\ResourceMember\CreateResourceMember diff --git a/lib/Command/OrganizationFolder/GetOrganizationFolder.php b/lib/Command/OrganizationFolder/GetOrganizationFolder.php new file mode 100644 index 0000000..21a6ce5 --- /dev/null +++ b/lib/Command/OrganizationFolder/GetOrganizationFolder.php @@ -0,0 +1,34 @@ +setName('organization-folders:get') + ->setDescription('Get organization folder by id') + ->addArgument('id', null, InputArgument::REQUIRED, 'Id of the organization folder to get'); + parent::configure(); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + $id = (int)$input->getArgument('id'); + + try { + $organizationFolder = $this->organizationFolderService->find($id); + + $this->writeTableInOutputFormat($input, $output, [$this->formatTableSerializable($organizationFolder)]); + return 0; + } catch (Exception $e) { + $output->writeln("Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}"); + return 1; + } + } +} diff --git a/lib/Command/OrganizationFolder/ListOrganizationFolders.php b/lib/Command/OrganizationFolder/ListOrganizationFolders.php index c284fc9..98b6349 100644 --- a/lib/Command/OrganizationFolder/ListOrganizationFolders.php +++ b/lib/Command/OrganizationFolder/ListOrganizationFolders.php @@ -19,9 +19,9 @@ class ListOrganizationFolders extends BaseCommand { protected function execute(InputInterface $input, OutputInterface $output): int { try { - $organizationFolderGroupfolders = $this->organizationFolderService->findAll(); + $organizationFolders = $this->organizationFolderService->findAll(); - $this->writeTableInOutputFormat($input, $output, $this->formatTableSerializables($organizationFolderGroupfolders)); + $this->writeTableInOutputFormat($input, $output, $this->formatTableSerializables($organizationFolders)); return 0; } catch (Exception $e) { $output->writeln("Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}"); diff --git a/lib/Command/OrganizationFolder/RemoveOrganizationFolder.php b/lib/Command/OrganizationFolder/RemoveOrganizationFolder.php new file mode 100644 index 0000000..c70b9dc --- /dev/null +++ b/lib/Command/OrganizationFolder/RemoveOrganizationFolder.php @@ -0,0 +1,34 @@ +setName('organization-folders:remove') + ->setDescription('Remove a new organization folder') + ->addArgument('id', null, InputArgument::REQUIRED, 'Id of the organization folder to remove'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + $id = (int)$input->getArgument('id'); + + try { + $this->organizationFolderService->remove($id); + + $output->writeln("done"); + + return 0; + } catch (Exception $e) { + $output->writeln("Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}"); + return 1; + } + } +} diff --git a/lib/Model/OrganizationFolder.php b/lib/Model/OrganizationFolder.php index 1c66d14..bf06ef8 100644 --- a/lib/Model/OrganizationFolder.php +++ b/lib/Model/OrganizationFolder.php @@ -27,6 +27,14 @@ class OrganizationFolder implements JsonSerializable, TableSerializable { return $this->quota; } + public function getOrganizationProvider(): string { + return $this->organizationProvider; + } + + public function getOrganizationId(): int { + return $this->organizationId; + } + public function jsonSerialize(): array { return [ 'id' => $this->id,