mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-12-06 11:22:41 +01:00
added occ commands to inspect organization providers, organizations and organization roles
This commit is contained in:
parent
21f3a39b06
commit
f85a93aa3a
11 changed files with 202 additions and 9 deletions
41
lib/Command/OrganizationProvider/GetOrganizationRole.php
Normal file
41
lib/Command/OrganizationProvider/GetOrganizationRole.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\OrganizationFolders\Command\OrganizationProvider;
|
||||
|
||||
use OCP\DB\Exception;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use OCA\OrganizationFolders\Command\BaseCommand;
|
||||
|
||||
class GetOrganizationRole extends BaseCommand {
|
||||
protected function configure(): void {
|
||||
$this
|
||||
->setName('organization-folders:get-organization-role')
|
||||
->setDescription('Get a specific organization role by id')
|
||||
->addArgument('provider-id', InputArgument::REQUIRED, 'provider to query')
|
||||
->addArgument('role-id', InputArgument::REQUIRED, '');
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
try {
|
||||
$providerId = $input->getArgument('provider-id');
|
||||
$roleId = $input->getArgument('role-id');
|
||||
|
||||
if(!$this->organizationProviderManager->hasOrganizationProvider($providerId)) {
|
||||
$output->writeln("<error>organization provider not found</error>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$role = $this->organizationProviderManager->getOrganizationProvider($providerId)->getRole($roleId);
|
||||
|
||||
$this->writeTableInOutputFormat($input, $output, [$this->formatTableSerializable($role)]);
|
||||
return 0;
|
||||
} catch (Exception $e) {
|
||||
$output->writeln("<error>Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}</error>");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue