From 6252ca26dceec394fa23d1e1c693fc8d3f31d859 Mon Sep 17 00:00:00 2001 From: Jonathan Treffler Date: Tue, 5 Nov 2024 00:48:00 +0100 Subject: [PATCH] added occ command to remove resource member --- appinfo/info.xml | 1 + .../ResourceMember/RemoveResourceMember.php | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/Command/ResourceMember/RemoveResourceMember.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 954540f..e0a7fe9 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -30,6 +30,7 @@ OCA\OrganizationFolders\Command\Resource\UpdateResource OCA\OrganizationFolders\Command\ResourceMember\CreateResourceMember OCA\OrganizationFolders\Command\ResourceMember\ListResourceMembers + OCA\OrganizationFolders\Command\ResourceMember\RemoveResourceMember OCA\OrganizationFolders\Command\OrganizationProvider\ListOrganizationProviders OCA\OrganizationFolders\Command\OrganizationProvider\ListOrganizations OCA\OrganizationFolders\Command\OrganizationProvider\ListOrganizationRoles diff --git a/lib/Command/ResourceMember/RemoveResourceMember.php b/lib/Command/ResourceMember/RemoveResourceMember.php new file mode 100644 index 0000000..d6b625b --- /dev/null +++ b/lib/Command/ResourceMember/RemoveResourceMember.php @@ -0,0 +1,34 @@ +setName('organization-folders:remove-resource-member') + ->setDescription('Remove a member of a resource') + ->addArgument('id', InputArgument::REQUIRED, 'Id of the resource member'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + $id = (int)$input->getArgument('id'); + + try { + $this->resourceMemberService->delete($id); + + $output->writeln("done"); + + return 0; + } catch (Exception $e) { + $output->writeln("Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}"); + return 1; + } + } +}