namespace OC\Core\Command\Group;
use OC\Core\Command\Base;
+use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\IUser;
use OCP\IUserManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
$group->addUser($user);
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'group') {
+ return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord()));
+ }
+ if ($argumentName === 'user') {
+ $groupId = $context->getWordAtIndex($context->getWordIndex() - 1);
+ $group = $this->groupManager->get($groupId);
+ if ($group === null) {
+ return [];
+ }
+
+ $members = array_map(static fn (IUser $user) => $user->getUID(), $group->searchUsers($context->getCurrentWord()));
+ $users = array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
+ return array_diff($users, $members);
+ }
+ return [];
+ }
}
namespace OC\Core\Command\Group;
use OC\Core\Command\Base;
+use OCP\IGroup;
use OCP\IGroupManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
}
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'groupid') {
+ return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord()));
+ }
+ return [];
+ }
}
use OC\Core\Command\Base;
use OCP\IGroup;
use OCP\IGroupManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
return 0;
}
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'groupid') {
+ return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord()));
+ }
+ return [];
+ }
}
namespace OC\Core\Command\Group;
use OC\Core\Command\Base;
+use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\IUser;
use OCP\IUserManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
$group->removeUser($user);
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'group') {
+ return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord()));
+ }
+ if ($argumentName === 'user') {
+ $groupId = $context->getWordAtIndex($context->getWordIndex() - 1);
+ $group = $this->groupManager->get($groupId);
+ if ($group === null) {
+ return [];
+ }
+ return array_map(static fn (IUser $user) => $user->getUID(), $group->searchUsers($context->getCurrentWord()));
+ }
+ return [];
+ }
}
*/
namespace OC\Core\Command\User;
+use OC\Core\Command\Base;
+use OCP\IUser;
use OCP\IUserManager;
-use Symfony\Component\Console\Command\Command;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-class Delete extends Command {
+class Delete extends Base {
/** @var IUserManager */
protected $userManager;
$output->writeln('<error>The specified user could not be deleted. Please check the logs.</error>');
return 1;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'uid') {
+ return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
+ }
+ return [];
+ }
}
*/
namespace OC\Core\Command\User;
+use OC\Core\Command\Base;
+use OCP\IUser;
use OCP\IUserManager;
-use Symfony\Component\Console\Command\Command;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-class Disable extends Command {
+class Disable extends Base {
/** @var IUserManager */
protected $userManager;
$output->writeln('<info>The specified user is disabled</info>');
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'uid') {
+ return array_map(
+ static fn (IUser $user) => $user->getUID(),
+ array_filter(
+ $this->userManager->search($context->getCurrentWord()),
+ static fn (IUser $user) => $user->isEnabled()
+ )
+ );
+ }
+ return [];
+ }
}
*/
namespace OC\Core\Command\User;
+use OC\Core\Command\Base;
+use OCP\IUser;
use OCP\IUserManager;
-use Symfony\Component\Console\Command\Command;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-class Enable extends Command {
+class Enable extends Base {
/** @var IUserManager */
protected $userManager;
$output->writeln('<info>The specified user is enabled</info>');
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'uid') {
+ return array_map(
+ static fn (IUser $user) => $user->getUID(),
+ array_filter(
+ $this->userManager->search($context->getCurrentWord()),
+ static fn (IUser $user) => !$user->isEnabled()
+ )
+ );
+ }
+ return [];
+ }
}
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
'quota' => $storage['quota'],
];
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'user') {
+ return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
+ }
+ return [];
+ }
}
*/
namespace OC\Core\Command\User;
+use OC\Core\Command\Base;
+use OCP\IUser;
use OCP\IUserManager;
-use Symfony\Component\Console\Command\Command;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-class LastSeen extends Command {
+class LastSeen extends Base {
/** @var IUserManager */
protected $userManager;
}
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'uid') {
+ return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
+ }
+ return [];
+ }
}
*/
namespace OC\Core\Command\User;
+use OC\Core\Command\Base;
+use OCP\IUser;
use OCP\IUserManager;
-use Symfony\Component\Console\Command\Command;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
-class ResetPassword extends Command {
+class ResetPassword extends Base {
/** @var IUserManager */
protected $userManager;
}
return 0;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'user') {
+ return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
+ }
+ return [];
+ }
}
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
return $settings;
}
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'uid') {
+ return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
+ }
+ if ($argumentName === 'app') {
+ $userId = $context->getWordAtIndex($context->getWordIndex() - 1);
+ $settings = $this->getUserSettings($userId, '');
+ return array_keys($settings);
+ }
+ if ($argumentName === 'key') {
+ $userId = $context->getWordAtIndex($context->getWordIndex() - 2);
+ $app = $context->getWordAtIndex($context->getWordIndex() - 1);
+ $settings = $this->getUserSettings($userId, $app);
+ return array_keys($settings[$app]);
+ }
+ return [];
+ }
}