@@ -117,12 +117,12 @@ |
||
| 117 | 117 | try { |
| 118 | 118 | $success = $user->setPassword($password); |
| 119 | 119 | } catch (\Exception $e) { |
| 120 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 120 | + $output->writeln('<error>'.$e->getMessage().'</error>'); |
|
| 121 | 121 | return 1; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if ($success) { |
| 125 | - $output->writeln("<info>Successfully reset password for " . $username . "</info>"); |
|
| 125 | + $output->writeln("<info>Successfully reset password for ".$username."</info>"); |
|
| 126 | 126 | } else { |
| 127 | 127 | $output->writeln("<error>Error while resetting password!</error>"); |
| 128 | 128 | return 1; |
@@ -39,98 +39,98 @@ |
||
| 39 | 39 | |
| 40 | 40 | class ResetPassword extends Command { |
| 41 | 41 | |
| 42 | - /** @var IUserManager */ |
|
| 43 | - protected $userManager; |
|
| 44 | - |
|
| 45 | - public function __construct(IUserManager $userManager) { |
|
| 46 | - $this->userManager = $userManager; |
|
| 47 | - parent::__construct(); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - protected function configure() { |
|
| 51 | - $this |
|
| 52 | - ->setName('user:resetpassword') |
|
| 53 | - ->setDescription('Resets the password of the named user') |
|
| 54 | - ->addArgument( |
|
| 55 | - 'user', |
|
| 56 | - InputArgument::REQUIRED, |
|
| 57 | - 'Username to reset password' |
|
| 58 | - ) |
|
| 59 | - ->addOption( |
|
| 60 | - 'password-from-env', |
|
| 61 | - null, |
|
| 62 | - InputOption::VALUE_NONE, |
|
| 63 | - 'read password from environment variable OC_PASS' |
|
| 64 | - ) |
|
| 65 | - ; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 69 | - $username = $input->getArgument('user'); |
|
| 70 | - |
|
| 71 | - /** @var $user \OCP\IUser */ |
|
| 72 | - $user = $this->userManager->get($username); |
|
| 73 | - if (is_null($user)) { |
|
| 74 | - $output->writeln('<error>User does not exist</error>'); |
|
| 75 | - return 1; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if ($input->getOption('password-from-env')) { |
|
| 79 | - $password = getenv('OC_PASS'); |
|
| 80 | - if (!$password) { |
|
| 81 | - $output->writeln('<error>--password-from-env given, but OC_PASS is empty!</error>'); |
|
| 82 | - return 1; |
|
| 83 | - } |
|
| 84 | - } elseif ($input->isInteractive()) { |
|
| 85 | - /** @var QuestionHelper $helper */ |
|
| 86 | - $helper = $this->getHelper('question'); |
|
| 87 | - |
|
| 88 | - if (\OCP\App::isEnabled('encryption')) { |
|
| 89 | - $output->writeln( |
|
| 90 | - '<error>Warning: Resetting the password when using encryption will result in data loss!</error>' |
|
| 91 | - ); |
|
| 92 | - |
|
| 93 | - $question = new ConfirmationQuestion('Do you want to continue?'); |
|
| 94 | - if (!$helper->ask($input, $output, $question)) { |
|
| 95 | - return 1; |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - $question = new Question('Enter a new password: '); |
|
| 100 | - $question->setHidden(true); |
|
| 101 | - $password = $helper->ask($input, $output, $question); |
|
| 102 | - |
|
| 103 | - if ($password === null) { |
|
| 104 | - $output->writeln("<error>Password cannot be empty!</error>"); |
|
| 105 | - return 1; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - $question = new Question('Confirm the new password: '); |
|
| 109 | - $question->setHidden(true); |
|
| 110 | - $confirm = $helper->ask($input, $output, $question); |
|
| 111 | - |
|
| 112 | - if ($password !== $confirm) { |
|
| 113 | - $output->writeln("<error>Passwords did not match!</error>"); |
|
| 114 | - return 1; |
|
| 115 | - } |
|
| 116 | - } else { |
|
| 117 | - $output->writeln("<error>Interactive input or --password-from-env is needed for entering a new password!</error>"); |
|
| 118 | - return 1; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - |
|
| 122 | - try { |
|
| 123 | - $success = $user->setPassword($password); |
|
| 124 | - } catch (\Exception $e) { |
|
| 125 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 126 | - return 1; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - if ($success) { |
|
| 130 | - $output->writeln("<info>Successfully reset password for " . $username . "</info>"); |
|
| 131 | - } else { |
|
| 132 | - $output->writeln("<error>Error while resetting password!</error>"); |
|
| 133 | - return 1; |
|
| 134 | - } |
|
| 135 | - } |
|
| 42 | + /** @var IUserManager */ |
|
| 43 | + protected $userManager; |
|
| 44 | + |
|
| 45 | + public function __construct(IUserManager $userManager) { |
|
| 46 | + $this->userManager = $userManager; |
|
| 47 | + parent::__construct(); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + protected function configure() { |
|
| 51 | + $this |
|
| 52 | + ->setName('user:resetpassword') |
|
| 53 | + ->setDescription('Resets the password of the named user') |
|
| 54 | + ->addArgument( |
|
| 55 | + 'user', |
|
| 56 | + InputArgument::REQUIRED, |
|
| 57 | + 'Username to reset password' |
|
| 58 | + ) |
|
| 59 | + ->addOption( |
|
| 60 | + 'password-from-env', |
|
| 61 | + null, |
|
| 62 | + InputOption::VALUE_NONE, |
|
| 63 | + 'read password from environment variable OC_PASS' |
|
| 64 | + ) |
|
| 65 | + ; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 69 | + $username = $input->getArgument('user'); |
|
| 70 | + |
|
| 71 | + /** @var $user \OCP\IUser */ |
|
| 72 | + $user = $this->userManager->get($username); |
|
| 73 | + if (is_null($user)) { |
|
| 74 | + $output->writeln('<error>User does not exist</error>'); |
|
| 75 | + return 1; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if ($input->getOption('password-from-env')) { |
|
| 79 | + $password = getenv('OC_PASS'); |
|
| 80 | + if (!$password) { |
|
| 81 | + $output->writeln('<error>--password-from-env given, but OC_PASS is empty!</error>'); |
|
| 82 | + return 1; |
|
| 83 | + } |
|
| 84 | + } elseif ($input->isInteractive()) { |
|
| 85 | + /** @var QuestionHelper $helper */ |
|
| 86 | + $helper = $this->getHelper('question'); |
|
| 87 | + |
|
| 88 | + if (\OCP\App::isEnabled('encryption')) { |
|
| 89 | + $output->writeln( |
|
| 90 | + '<error>Warning: Resetting the password when using encryption will result in data loss!</error>' |
|
| 91 | + ); |
|
| 92 | + |
|
| 93 | + $question = new ConfirmationQuestion('Do you want to continue?'); |
|
| 94 | + if (!$helper->ask($input, $output, $question)) { |
|
| 95 | + return 1; |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + $question = new Question('Enter a new password: '); |
|
| 100 | + $question->setHidden(true); |
|
| 101 | + $password = $helper->ask($input, $output, $question); |
|
| 102 | + |
|
| 103 | + if ($password === null) { |
|
| 104 | + $output->writeln("<error>Password cannot be empty!</error>"); |
|
| 105 | + return 1; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + $question = new Question('Confirm the new password: '); |
|
| 109 | + $question->setHidden(true); |
|
| 110 | + $confirm = $helper->ask($input, $output, $question); |
|
| 111 | + |
|
| 112 | + if ($password !== $confirm) { |
|
| 113 | + $output->writeln("<error>Passwords did not match!</error>"); |
|
| 114 | + return 1; |
|
| 115 | + } |
|
| 116 | + } else { |
|
| 117 | + $output->writeln("<error>Interactive input or --password-from-env is needed for entering a new password!</error>"); |
|
| 118 | + return 1; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + |
|
| 122 | + try { |
|
| 123 | + $success = $user->setPassword($password); |
|
| 124 | + } catch (\Exception $e) { |
|
| 125 | + $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 126 | + return 1; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + if ($success) { |
|
| 130 | + $output->writeln("<info>Successfully reset password for " . $username . "</info>"); |
|
| 131 | + } else { |
|
| 132 | + $output->writeln("<error>Error while resetting password!</error>"); |
|
| 133 | + return 1; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | 136 | } |
@@ -36,125 +36,125 @@ |
||
| 36 | 36 | use Symfony\Component\Console\Question\Question; |
| 37 | 37 | |
| 38 | 38 | class Add extends Command { |
| 39 | - /** @var \OCP\IUserManager */ |
|
| 40 | - protected $userManager; |
|
| 41 | - |
|
| 42 | - /** @var \OCP\IGroupManager */ |
|
| 43 | - protected $groupManager; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @param IUserManager $userManager |
|
| 47 | - * @param IGroupManager $groupManager |
|
| 48 | - */ |
|
| 49 | - public function __construct(IUserManager $userManager, IGroupManager $groupManager) { |
|
| 50 | - parent::__construct(); |
|
| 51 | - $this->userManager = $userManager; |
|
| 52 | - $this->groupManager = $groupManager; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - protected function configure() { |
|
| 56 | - $this |
|
| 57 | - ->setName('user:add') |
|
| 58 | - ->setDescription('adds a user') |
|
| 59 | - ->addArgument( |
|
| 60 | - 'uid', |
|
| 61 | - InputArgument::REQUIRED, |
|
| 62 | - 'User ID used to login (must only contain a-z, A-Z, 0-9, -, _ and @)' |
|
| 63 | - ) |
|
| 64 | - ->addOption( |
|
| 65 | - 'password-from-env', |
|
| 66 | - null, |
|
| 67 | - InputOption::VALUE_NONE, |
|
| 68 | - 'read password from environment variable OC_PASS' |
|
| 69 | - ) |
|
| 70 | - ->addOption( |
|
| 71 | - 'display-name', |
|
| 72 | - null, |
|
| 73 | - InputOption::VALUE_OPTIONAL, |
|
| 74 | - 'User name used in the web UI (can contain any characters)' |
|
| 75 | - ) |
|
| 76 | - ->addOption( |
|
| 77 | - 'group', |
|
| 78 | - 'g', |
|
| 79 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
| 80 | - 'groups the user should be added to (The group will be created if it does not exist)' |
|
| 81 | - ); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 85 | - $uid = $input->getArgument('uid'); |
|
| 86 | - if ($this->userManager->userExists($uid)) { |
|
| 87 | - $output->writeln('<error>The user "' . $uid . '" already exists.</error>'); |
|
| 88 | - return 1; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - if ($input->getOption('password-from-env')) { |
|
| 92 | - $password = getenv('OC_PASS'); |
|
| 93 | - if (!$password) { |
|
| 94 | - $output->writeln('<error>--password-from-env given, but OC_PASS is empty!</error>'); |
|
| 95 | - return 1; |
|
| 96 | - } |
|
| 97 | - } elseif ($input->isInteractive()) { |
|
| 98 | - /** @var QuestionHelper $helper */ |
|
| 99 | - $helper = $this->getHelper('question'); |
|
| 100 | - |
|
| 101 | - $question = new Question('Enter password: '); |
|
| 102 | - $question->setHidden(true); |
|
| 103 | - $password = $helper->ask($input, $output, $question); |
|
| 104 | - |
|
| 105 | - $question = new Question('Confirm password: '); |
|
| 106 | - $question->setHidden(true); |
|
| 107 | - $confirm = $helper->ask($input, $output,$question); |
|
| 108 | - |
|
| 109 | - if ($password !== $confirm) { |
|
| 110 | - $output->writeln("<error>Passwords did not match!</error>"); |
|
| 111 | - return 1; |
|
| 112 | - } |
|
| 113 | - } else { |
|
| 114 | - $output->writeln("<error>Interactive input or --password-from-env is needed for entering a password!</error>"); |
|
| 115 | - return 1; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - try { |
|
| 119 | - $user = $this->userManager->createUser( |
|
| 120 | - $input->getArgument('uid'), |
|
| 121 | - $password |
|
| 122 | - ); |
|
| 123 | - } catch (\Exception $e) { |
|
| 124 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 125 | - return 1; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - |
|
| 129 | - if ($user instanceof IUser) { |
|
| 130 | - $output->writeln('<info>The user "' . $user->getUID() . '" was created successfully</info>'); |
|
| 131 | - } else { |
|
| 132 | - $output->writeln('<error>An error occurred while creating the user</error>'); |
|
| 133 | - return 1; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - if ($input->getOption('display-name')) { |
|
| 137 | - $user->setDisplayName($input->getOption('display-name')); |
|
| 138 | - $output->writeln('Display name set to "' . $user->getDisplayName() . '"'); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - $groups = $input->getOption('group'); |
|
| 142 | - |
|
| 143 | - if (!empty($groups)) { |
|
| 144 | - // Make sure we init the Filesystem for the user, in case we need to |
|
| 145 | - // init some group shares. |
|
| 146 | - Filesystem::init($user->getUID(), ''); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - foreach ($groups as $groupName) { |
|
| 150 | - $group = $this->groupManager->get($groupName); |
|
| 151 | - if (!$group) { |
|
| 152 | - $this->groupManager->createGroup($groupName); |
|
| 153 | - $group = $this->groupManager->get($groupName); |
|
| 154 | - $output->writeln('Created group "' . $group->getGID() . '"'); |
|
| 155 | - } |
|
| 156 | - $group->addUser($user); |
|
| 157 | - $output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"'); |
|
| 158 | - } |
|
| 159 | - } |
|
| 39 | + /** @var \OCP\IUserManager */ |
|
| 40 | + protected $userManager; |
|
| 41 | + |
|
| 42 | + /** @var \OCP\IGroupManager */ |
|
| 43 | + protected $groupManager; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @param IUserManager $userManager |
|
| 47 | + * @param IGroupManager $groupManager |
|
| 48 | + */ |
|
| 49 | + public function __construct(IUserManager $userManager, IGroupManager $groupManager) { |
|
| 50 | + parent::__construct(); |
|
| 51 | + $this->userManager = $userManager; |
|
| 52 | + $this->groupManager = $groupManager; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + protected function configure() { |
|
| 56 | + $this |
|
| 57 | + ->setName('user:add') |
|
| 58 | + ->setDescription('adds a user') |
|
| 59 | + ->addArgument( |
|
| 60 | + 'uid', |
|
| 61 | + InputArgument::REQUIRED, |
|
| 62 | + 'User ID used to login (must only contain a-z, A-Z, 0-9, -, _ and @)' |
|
| 63 | + ) |
|
| 64 | + ->addOption( |
|
| 65 | + 'password-from-env', |
|
| 66 | + null, |
|
| 67 | + InputOption::VALUE_NONE, |
|
| 68 | + 'read password from environment variable OC_PASS' |
|
| 69 | + ) |
|
| 70 | + ->addOption( |
|
| 71 | + 'display-name', |
|
| 72 | + null, |
|
| 73 | + InputOption::VALUE_OPTIONAL, |
|
| 74 | + 'User name used in the web UI (can contain any characters)' |
|
| 75 | + ) |
|
| 76 | + ->addOption( |
|
| 77 | + 'group', |
|
| 78 | + 'g', |
|
| 79 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
| 80 | + 'groups the user should be added to (The group will be created if it does not exist)' |
|
| 81 | + ); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 85 | + $uid = $input->getArgument('uid'); |
|
| 86 | + if ($this->userManager->userExists($uid)) { |
|
| 87 | + $output->writeln('<error>The user "' . $uid . '" already exists.</error>'); |
|
| 88 | + return 1; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + if ($input->getOption('password-from-env')) { |
|
| 92 | + $password = getenv('OC_PASS'); |
|
| 93 | + if (!$password) { |
|
| 94 | + $output->writeln('<error>--password-from-env given, but OC_PASS is empty!</error>'); |
|
| 95 | + return 1; |
|
| 96 | + } |
|
| 97 | + } elseif ($input->isInteractive()) { |
|
| 98 | + /** @var QuestionHelper $helper */ |
|
| 99 | + $helper = $this->getHelper('question'); |
|
| 100 | + |
|
| 101 | + $question = new Question('Enter password: '); |
|
| 102 | + $question->setHidden(true); |
|
| 103 | + $password = $helper->ask($input, $output, $question); |
|
| 104 | + |
|
| 105 | + $question = new Question('Confirm password: '); |
|
| 106 | + $question->setHidden(true); |
|
| 107 | + $confirm = $helper->ask($input, $output,$question); |
|
| 108 | + |
|
| 109 | + if ($password !== $confirm) { |
|
| 110 | + $output->writeln("<error>Passwords did not match!</error>"); |
|
| 111 | + return 1; |
|
| 112 | + } |
|
| 113 | + } else { |
|
| 114 | + $output->writeln("<error>Interactive input or --password-from-env is needed for entering a password!</error>"); |
|
| 115 | + return 1; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + try { |
|
| 119 | + $user = $this->userManager->createUser( |
|
| 120 | + $input->getArgument('uid'), |
|
| 121 | + $password |
|
| 122 | + ); |
|
| 123 | + } catch (\Exception $e) { |
|
| 124 | + $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 125 | + return 1; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + |
|
| 129 | + if ($user instanceof IUser) { |
|
| 130 | + $output->writeln('<info>The user "' . $user->getUID() . '" was created successfully</info>'); |
|
| 131 | + } else { |
|
| 132 | + $output->writeln('<error>An error occurred while creating the user</error>'); |
|
| 133 | + return 1; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + if ($input->getOption('display-name')) { |
|
| 137 | + $user->setDisplayName($input->getOption('display-name')); |
|
| 138 | + $output->writeln('Display name set to "' . $user->getDisplayName() . '"'); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + $groups = $input->getOption('group'); |
|
| 142 | + |
|
| 143 | + if (!empty($groups)) { |
|
| 144 | + // Make sure we init the Filesystem for the user, in case we need to |
|
| 145 | + // init some group shares. |
|
| 146 | + Filesystem::init($user->getUID(), ''); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + foreach ($groups as $groupName) { |
|
| 150 | + $group = $this->groupManager->get($groupName); |
|
| 151 | + if (!$group) { |
|
| 152 | + $this->groupManager->createGroup($groupName); |
|
| 153 | + $group = $this->groupManager->get($groupName); |
|
| 154 | + $output->writeln('Created group "' . $group->getGID() . '"'); |
|
| 155 | + } |
|
| 156 | + $group->addUser($user); |
|
| 157 | + $output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"'); |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | 160 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 85 | 85 | $uid = $input->getArgument('uid'); |
| 86 | 86 | if ($this->userManager->userExists($uid)) { |
| 87 | - $output->writeln('<error>The user "' . $uid . '" already exists.</error>'); |
|
| 87 | + $output->writeln('<error>The user "'.$uid.'" already exists.</error>'); |
|
| 88 | 88 | return 1; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $question = new Question('Confirm password: '); |
| 106 | 106 | $question->setHidden(true); |
| 107 | - $confirm = $helper->ask($input, $output,$question); |
|
| 107 | + $confirm = $helper->ask($input, $output, $question); |
|
| 108 | 108 | |
| 109 | 109 | if ($password !== $confirm) { |
| 110 | 110 | $output->writeln("<error>Passwords did not match!</error>"); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | $password |
| 122 | 122 | ); |
| 123 | 123 | } catch (\Exception $e) { |
| 124 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 124 | + $output->writeln('<error>'.$e->getMessage().'</error>'); |
|
| 125 | 125 | return 1; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | if ($user instanceof IUser) { |
| 130 | - $output->writeln('<info>The user "' . $user->getUID() . '" was created successfully</info>'); |
|
| 130 | + $output->writeln('<info>The user "'.$user->getUID().'" was created successfully</info>'); |
|
| 131 | 131 | } else { |
| 132 | 132 | $output->writeln('<error>An error occurred while creating the user</error>'); |
| 133 | 133 | return 1; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | if ($input->getOption('display-name')) { |
| 137 | 137 | $user->setDisplayName($input->getOption('display-name')); |
| 138 | - $output->writeln('Display name set to "' . $user->getDisplayName() . '"'); |
|
| 138 | + $output->writeln('Display name set to "'.$user->getDisplayName().'"'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $groups = $input->getOption('group'); |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | if (!$group) { |
| 152 | 152 | $this->groupManager->createGroup($groupName); |
| 153 | 153 | $group = $this->groupManager->get($groupName); |
| 154 | - $output->writeln('Created group "' . $group->getGID() . '"'); |
|
| 154 | + $output->writeln('Created group "'.$group->getGID().'"'); |
|
| 155 | 155 | } |
| 156 | 156 | $group->addUser($user); |
| 157 | - $output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"'); |
|
| 157 | + $output->writeln('User "'.$user->getUID().'" added to group "'.$group->getGID().'"'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -32,56 +32,56 @@ |
||
| 32 | 32 | use Symfony\Component\Console\Output\OutputInterface; |
| 33 | 33 | |
| 34 | 34 | class Report extends Command { |
| 35 | - /** @var IUserManager */ |
|
| 36 | - protected $userManager; |
|
| 35 | + /** @var IUserManager */ |
|
| 36 | + protected $userManager; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param IUserManager $userManager |
|
| 40 | - */ |
|
| 41 | - public function __construct(IUserManager $userManager) { |
|
| 42 | - $this->userManager = $userManager; |
|
| 43 | - parent::__construct(); |
|
| 44 | - } |
|
| 38 | + /** |
|
| 39 | + * @param IUserManager $userManager |
|
| 40 | + */ |
|
| 41 | + public function __construct(IUserManager $userManager) { |
|
| 42 | + $this->userManager = $userManager; |
|
| 43 | + parent::__construct(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - protected function configure() { |
|
| 47 | - $this |
|
| 48 | - ->setName('user:report') |
|
| 49 | - ->setDescription('shows how many users have access'); |
|
| 50 | - } |
|
| 46 | + protected function configure() { |
|
| 47 | + $this |
|
| 48 | + ->setName('user:report') |
|
| 49 | + ->setDescription('shows how many users have access'); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 53 | - $table = new Table($output); |
|
| 54 | - $table->setHeaders(array('User Report', '')); |
|
| 55 | - $userCountArray = $this->countUsers(); |
|
| 56 | - if(!empty($userCountArray)) { |
|
| 57 | - $total = 0; |
|
| 58 | - $rows = array(); |
|
| 59 | - foreach($userCountArray as $classname => $users) { |
|
| 60 | - $total += $users; |
|
| 61 | - $rows[] = array($classname, $users); |
|
| 62 | - } |
|
| 52 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 53 | + $table = new Table($output); |
|
| 54 | + $table->setHeaders(array('User Report', '')); |
|
| 55 | + $userCountArray = $this->countUsers(); |
|
| 56 | + if(!empty($userCountArray)) { |
|
| 57 | + $total = 0; |
|
| 58 | + $rows = array(); |
|
| 59 | + foreach($userCountArray as $classname => $users) { |
|
| 60 | + $total += $users; |
|
| 61 | + $rows[] = array($classname, $users); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - $rows[] = array(' '); |
|
| 65 | - $rows[] = array('total users', $total); |
|
| 66 | - } else { |
|
| 67 | - $rows[] = array('No backend enabled that supports user counting', ''); |
|
| 68 | - } |
|
| 64 | + $rows[] = array(' '); |
|
| 65 | + $rows[] = array('total users', $total); |
|
| 66 | + } else { |
|
| 67 | + $rows[] = array('No backend enabled that supports user counting', ''); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - $userDirectoryCount = $this->countUserDirectories(); |
|
| 71 | - $rows[] = array(' '); |
|
| 72 | - $rows[] = array('user directories', $userDirectoryCount); |
|
| 70 | + $userDirectoryCount = $this->countUserDirectories(); |
|
| 71 | + $rows[] = array(' '); |
|
| 72 | + $rows[] = array('user directories', $userDirectoryCount); |
|
| 73 | 73 | |
| 74 | - $table->setRows($rows); |
|
| 75 | - $table->render(); |
|
| 76 | - } |
|
| 74 | + $table->setRows($rows); |
|
| 75 | + $table->render(); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - private function countUsers() { |
|
| 79 | - return $this->userManager->countUsers(); |
|
| 80 | - } |
|
| 78 | + private function countUsers() { |
|
| 79 | + return $this->userManager->countUsers(); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - private function countUserDirectories() { |
|
| 83 | - $dataview = new \OC\Files\View('/'); |
|
| 84 | - $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory'); |
|
| 85 | - return count($userDirectories); |
|
| 86 | - } |
|
| 82 | + private function countUserDirectories() { |
|
| 83 | + $dataview = new \OC\Files\View('/'); |
|
| 84 | + $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory'); |
|
| 85 | + return count($userDirectories); |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -53,10 +53,10 @@ |
||
| 53 | 53 | $table = new Table($output); |
| 54 | 54 | $table->setHeaders(array('User Report', '')); |
| 55 | 55 | $userCountArray = $this->countUsers(); |
| 56 | - if(!empty($userCountArray)) { |
|
| 56 | + if (!empty($userCountArray)) { |
|
| 57 | 57 | $total = 0; |
| 58 | 58 | $rows = array(); |
| 59 | - foreach($userCountArray as $classname => $users) { |
|
| 59 | + foreach ($userCountArray as $classname => $users) { |
|
| 60 | 60 | $total += $users; |
| 61 | 61 | $rows[] = array($classname, $users); |
| 62 | 62 | } |
@@ -32,40 +32,40 @@ |
||
| 32 | 32 | use Symfony\Component\Console\Input\InputArgument; |
| 33 | 33 | |
| 34 | 34 | class Delete extends Command { |
| 35 | - /** @var IUserManager */ |
|
| 36 | - protected $userManager; |
|
| 35 | + /** @var IUserManager */ |
|
| 36 | + protected $userManager; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param IUserManager $userManager |
|
| 40 | - */ |
|
| 41 | - public function __construct(IUserManager $userManager) { |
|
| 42 | - $this->userManager = $userManager; |
|
| 43 | - parent::__construct(); |
|
| 44 | - } |
|
| 38 | + /** |
|
| 39 | + * @param IUserManager $userManager |
|
| 40 | + */ |
|
| 41 | + public function __construct(IUserManager $userManager) { |
|
| 42 | + $this->userManager = $userManager; |
|
| 43 | + parent::__construct(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - protected function configure() { |
|
| 47 | - $this |
|
| 48 | - ->setName('user:delete') |
|
| 49 | - ->setDescription('deletes the specified user') |
|
| 50 | - ->addArgument( |
|
| 51 | - 'uid', |
|
| 52 | - InputArgument::REQUIRED, |
|
| 53 | - 'the username' |
|
| 54 | - ); |
|
| 55 | - } |
|
| 46 | + protected function configure() { |
|
| 47 | + $this |
|
| 48 | + ->setName('user:delete') |
|
| 49 | + ->setDescription('deletes the specified user') |
|
| 50 | + ->addArgument( |
|
| 51 | + 'uid', |
|
| 52 | + InputArgument::REQUIRED, |
|
| 53 | + 'the username' |
|
| 54 | + ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 58 | - $user = $this->userManager->get($input->getArgument('uid')); |
|
| 59 | - if (is_null($user)) { |
|
| 60 | - $output->writeln('<error>User does not exist</error>'); |
|
| 61 | - return; |
|
| 62 | - } |
|
| 57 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 58 | + $user = $this->userManager->get($input->getArgument('uid')); |
|
| 59 | + if (is_null($user)) { |
|
| 60 | + $output->writeln('<error>User does not exist</error>'); |
|
| 61 | + return; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - if ($user->delete()) { |
|
| 65 | - $output->writeln('<info>The specified user was deleted</info>'); |
|
| 66 | - return; |
|
| 67 | - } |
|
| 64 | + if ($user->delete()) { |
|
| 65 | + $output->writeln('<info>The specified user was deleted</info>'); |
|
| 66 | + return; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $output->writeln('<error>The specified user could not be deleted. Please check the logs.</error>'); |
|
| 70 | - } |
|
| 69 | + $output->writeln('<error>The specified user could not be deleted. Please check the logs.</error>'); |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | class WebCron extends Base { |
| 29 | 29 | |
| 30 | - protected function getMode() { |
|
| 31 | - return 'webcron'; |
|
| 32 | - } |
|
| 30 | + protected function getMode() { |
|
| 31 | + return 'webcron'; |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -39,39 +39,39 @@ |
||
| 39 | 39 | abstract class Base extends Command { |
| 40 | 40 | |
| 41 | 41 | |
| 42 | - abstract protected function getMode(); |
|
| 42 | + abstract protected function getMode(); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var \OCP\IConfig |
|
| 46 | - */ |
|
| 47 | - protected $config; |
|
| 44 | + /** |
|
| 45 | + * @var \OCP\IConfig |
|
| 46 | + */ |
|
| 47 | + protected $config; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param \OCP\IConfig $config |
|
| 51 | - */ |
|
| 52 | - public function __construct(IConfig $config) { |
|
| 53 | - $this->config = $config; |
|
| 54 | - parent::__construct(); |
|
| 55 | - } |
|
| 49 | + /** |
|
| 50 | + * @param \OCP\IConfig $config |
|
| 51 | + */ |
|
| 52 | + public function __construct(IConfig $config) { |
|
| 53 | + $this->config = $config; |
|
| 54 | + parent::__construct(); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - protected function configure() { |
|
| 58 | - $mode = $this->getMode(); |
|
| 59 | - $this |
|
| 60 | - ->setName("background:$mode") |
|
| 61 | - ->setDescription("Use $mode to run background jobs"); |
|
| 62 | - } |
|
| 57 | + protected function configure() { |
|
| 58 | + $mode = $this->getMode(); |
|
| 59 | + $this |
|
| 60 | + ->setName("background:$mode") |
|
| 61 | + ->setDescription("Use $mode to run background jobs"); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Executing this command will set the background job mode for owncloud. |
|
| 66 | - * The mode to set is specified by the concrete sub class by implementing the |
|
| 67 | - * getMode() function. |
|
| 68 | - * |
|
| 69 | - * @param InputInterface $input |
|
| 70 | - * @param OutputInterface $output |
|
| 71 | - */ |
|
| 72 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 73 | - $mode = $this->getMode(); |
|
| 74 | - $this->config->setAppValue( 'core', 'backgroundjobs_mode', $mode ); |
|
| 75 | - $output->writeln("Set mode for background jobs to '$mode'"); |
|
| 76 | - } |
|
| 64 | + /** |
|
| 65 | + * Executing this command will set the background job mode for owncloud. |
|
| 66 | + * The mode to set is specified by the concrete sub class by implementing the |
|
| 67 | + * getMode() function. |
|
| 68 | + * |
|
| 69 | + * @param InputInterface $input |
|
| 70 | + * @param OutputInterface $output |
|
| 71 | + */ |
|
| 72 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 73 | + $mode = $this->getMode(); |
|
| 74 | + $this->config->setAppValue( 'core', 'backgroundjobs_mode', $mode ); |
|
| 75 | + $output->writeln("Set mode for background jobs to '$mode'"); |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 73 | 73 | $mode = $this->getMode(); |
| 74 | - $this->config->setAppValue( 'core', 'backgroundjobs_mode', $mode ); |
|
| 74 | + $this->config->setAppValue('core', 'backgroundjobs_mode', $mode); |
|
| 75 | 75 | $output->writeln("Set mode for background jobs to '$mode'"); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | class Cron extends Base { |
| 29 | 29 | |
| 30 | - protected function getMode() { |
|
| 31 | - return 'cron'; |
|
| 32 | - } |
|
| 30 | + protected function getMode() { |
|
| 31 | + return 'cron'; |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | class Ajax extends Base { |
| 29 | 29 | |
| 30 | - protected function getMode() { |
|
| 31 | - return 'ajax'; |
|
| 32 | - } |
|
| 30 | + protected function getMode() { |
|
| 31 | + return 'ajax'; |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -32,127 +32,127 @@ |
||
| 32 | 32 | use Symfony\Component\Console\Output\OutputInterface; |
| 33 | 33 | |
| 34 | 34 | class ListConfigs extends Base { |
| 35 | - protected $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY; |
|
| 36 | - |
|
| 37 | - /** * @var SystemConfig */ |
|
| 38 | - protected $systemConfig; |
|
| 39 | - |
|
| 40 | - /** @var IAppConfig */ |
|
| 41 | - protected $appConfig; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @param SystemConfig $systemConfig |
|
| 45 | - * @param IAppConfig $appConfig |
|
| 46 | - */ |
|
| 47 | - public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) { |
|
| 48 | - parent::__construct(); |
|
| 49 | - $this->systemConfig = $systemConfig; |
|
| 50 | - $this->appConfig = $appConfig; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - protected function configure() { |
|
| 54 | - parent::configure(); |
|
| 55 | - |
|
| 56 | - $this |
|
| 57 | - ->setName('config:list') |
|
| 58 | - ->setDescription('List all configs') |
|
| 59 | - ->addArgument( |
|
| 60 | - 'app', |
|
| 61 | - InputArgument::OPTIONAL, |
|
| 62 | - 'Name of the app ("system" to get the config.php values, "all" for all apps and system)', |
|
| 63 | - 'all' |
|
| 64 | - ) |
|
| 65 | - ->addOption( |
|
| 66 | - 'private', |
|
| 67 | - null, |
|
| 68 | - InputOption::VALUE_NONE, |
|
| 69 | - 'Use this option when you want to include sensitive configs like passwords, salts, ...' |
|
| 70 | - ) |
|
| 71 | - ; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 75 | - $app = $input->getArgument('app'); |
|
| 76 | - $noSensitiveValues = !$input->getOption('private'); |
|
| 77 | - |
|
| 78 | - switch ($app) { |
|
| 79 | - case 'system': |
|
| 80 | - $configs = [ |
|
| 81 | - 'system' => $this->getSystemConfigs($noSensitiveValues), |
|
| 82 | - ]; |
|
| 83 | - break; |
|
| 84 | - |
|
| 85 | - case 'all': |
|
| 86 | - $apps = $this->appConfig->getApps(); |
|
| 87 | - $configs = [ |
|
| 88 | - 'system' => $this->getSystemConfigs($noSensitiveValues), |
|
| 89 | - 'apps' => [], |
|
| 90 | - ]; |
|
| 91 | - foreach ($apps as $appName) { |
|
| 92 | - $configs['apps'][$appName] = $this->getAppConfigs($appName, $noSensitiveValues); |
|
| 93 | - } |
|
| 94 | - break; |
|
| 95 | - |
|
| 96 | - default: |
|
| 97 | - $configs = [ |
|
| 98 | - 'apps' => [ |
|
| 99 | - $app => $this->getAppConfigs($app, $noSensitiveValues), |
|
| 100 | - ], |
|
| 101 | - ]; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $this->writeArrayInOutputFormat($input, $output, $configs); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Get the system configs |
|
| 109 | - * |
|
| 110 | - * @param bool $noSensitiveValues |
|
| 111 | - * @return array |
|
| 112 | - */ |
|
| 113 | - protected function getSystemConfigs($noSensitiveValues) { |
|
| 114 | - $keys = $this->systemConfig->getKeys(); |
|
| 115 | - |
|
| 116 | - $configs = []; |
|
| 117 | - foreach ($keys as $key) { |
|
| 118 | - if ($noSensitiveValues) { |
|
| 119 | - $value = $this->systemConfig->getFilteredValue($key, serialize(null)); |
|
| 120 | - } else { |
|
| 121 | - $value = $this->systemConfig->getValue($key, serialize(null)); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - if ($value !== 'N;') { |
|
| 125 | - $configs[$key] = $value; |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - return $configs; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Get the app configs |
|
| 134 | - * |
|
| 135 | - * @param string $app |
|
| 136 | - * @param bool $noSensitiveValues |
|
| 137 | - * @return array |
|
| 138 | - */ |
|
| 139 | - protected function getAppConfigs($app, $noSensitiveValues) { |
|
| 140 | - if ($noSensitiveValues) { |
|
| 141 | - return $this->appConfig->getFilteredValues($app, false); |
|
| 142 | - } else { |
|
| 143 | - return $this->appConfig->getValues($app, false); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * @param string $argumentName |
|
| 149 | - * @param CompletionContext $context |
|
| 150 | - * @return string[] |
|
| 151 | - */ |
|
| 152 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 153 | - if ($argumentName === 'app') { |
|
| 154 | - return array_merge(['all', 'system'], \OC_App::getAllApps()); |
|
| 155 | - } |
|
| 156 | - return []; |
|
| 157 | - } |
|
| 35 | + protected $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY; |
|
| 36 | + |
|
| 37 | + /** * @var SystemConfig */ |
|
| 38 | + protected $systemConfig; |
|
| 39 | + |
|
| 40 | + /** @var IAppConfig */ |
|
| 41 | + protected $appConfig; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @param SystemConfig $systemConfig |
|
| 45 | + * @param IAppConfig $appConfig |
|
| 46 | + */ |
|
| 47 | + public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) { |
|
| 48 | + parent::__construct(); |
|
| 49 | + $this->systemConfig = $systemConfig; |
|
| 50 | + $this->appConfig = $appConfig; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + protected function configure() { |
|
| 54 | + parent::configure(); |
|
| 55 | + |
|
| 56 | + $this |
|
| 57 | + ->setName('config:list') |
|
| 58 | + ->setDescription('List all configs') |
|
| 59 | + ->addArgument( |
|
| 60 | + 'app', |
|
| 61 | + InputArgument::OPTIONAL, |
|
| 62 | + 'Name of the app ("system" to get the config.php values, "all" for all apps and system)', |
|
| 63 | + 'all' |
|
| 64 | + ) |
|
| 65 | + ->addOption( |
|
| 66 | + 'private', |
|
| 67 | + null, |
|
| 68 | + InputOption::VALUE_NONE, |
|
| 69 | + 'Use this option when you want to include sensitive configs like passwords, salts, ...' |
|
| 70 | + ) |
|
| 71 | + ; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 75 | + $app = $input->getArgument('app'); |
|
| 76 | + $noSensitiveValues = !$input->getOption('private'); |
|
| 77 | + |
|
| 78 | + switch ($app) { |
|
| 79 | + case 'system': |
|
| 80 | + $configs = [ |
|
| 81 | + 'system' => $this->getSystemConfigs($noSensitiveValues), |
|
| 82 | + ]; |
|
| 83 | + break; |
|
| 84 | + |
|
| 85 | + case 'all': |
|
| 86 | + $apps = $this->appConfig->getApps(); |
|
| 87 | + $configs = [ |
|
| 88 | + 'system' => $this->getSystemConfigs($noSensitiveValues), |
|
| 89 | + 'apps' => [], |
|
| 90 | + ]; |
|
| 91 | + foreach ($apps as $appName) { |
|
| 92 | + $configs['apps'][$appName] = $this->getAppConfigs($appName, $noSensitiveValues); |
|
| 93 | + } |
|
| 94 | + break; |
|
| 95 | + |
|
| 96 | + default: |
|
| 97 | + $configs = [ |
|
| 98 | + 'apps' => [ |
|
| 99 | + $app => $this->getAppConfigs($app, $noSensitiveValues), |
|
| 100 | + ], |
|
| 101 | + ]; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $this->writeArrayInOutputFormat($input, $output, $configs); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Get the system configs |
|
| 109 | + * |
|
| 110 | + * @param bool $noSensitiveValues |
|
| 111 | + * @return array |
|
| 112 | + */ |
|
| 113 | + protected function getSystemConfigs($noSensitiveValues) { |
|
| 114 | + $keys = $this->systemConfig->getKeys(); |
|
| 115 | + |
|
| 116 | + $configs = []; |
|
| 117 | + foreach ($keys as $key) { |
|
| 118 | + if ($noSensitiveValues) { |
|
| 119 | + $value = $this->systemConfig->getFilteredValue($key, serialize(null)); |
|
| 120 | + } else { |
|
| 121 | + $value = $this->systemConfig->getValue($key, serialize(null)); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + if ($value !== 'N;') { |
|
| 125 | + $configs[$key] = $value; |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + return $configs; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Get the app configs |
|
| 134 | + * |
|
| 135 | + * @param string $app |
|
| 136 | + * @param bool $noSensitiveValues |
|
| 137 | + * @return array |
|
| 138 | + */ |
|
| 139 | + protected function getAppConfigs($app, $noSensitiveValues) { |
|
| 140 | + if ($noSensitiveValues) { |
|
| 141 | + return $this->appConfig->getFilteredValues($app, false); |
|
| 142 | + } else { |
|
| 143 | + return $this->appConfig->getValues($app, false); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * @param string $argumentName |
|
| 149 | + * @param CompletionContext $context |
|
| 150 | + * @return string[] |
|
| 151 | + */ |
|
| 152 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 153 | + if ($argumentName === 'app') { |
|
| 154 | + return array_merge(['all', 'system'], \OC_App::getAllApps()); |
|
| 155 | + } |
|
| 156 | + return []; |
|
| 157 | + } |
|
| 158 | 158 | } |