diff --git a/appinfo/info.xml b/appinfo/info.xml
index 49da0f238..c7fc3da44 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -62,6 +62,7 @@
OCA\Deck\Command\UserExport
OCA\Deck\Command\BoardImport
OCA\Deck\Command\TransferOwnership
+ OCA\Deck\Command\CalendarToggle
diff --git a/composer.lock b/composer.lock
index e0c144760..14199b9c1 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "6950663d9d213151028e780637480220",
+ "content-hash": "2a3a67d1b7c70fe1cee2183c26b0c906",
"packages": [
{
"name": "justinrainbow/json-schema",
diff --git a/lib/Command/CalendarToggle.php b/lib/Command/CalendarToggle.php
new file mode 100644
index 000000000..2381cff94
--- /dev/null
+++ b/lib/Command/CalendarToggle.php
@@ -0,0 +1,67 @@
+userManager = $userManager;
+ $this->config = $config;
+ }
+
+ protected function configure() {
+ $this
+ ->setName('deck:calendar-toggle')
+ ->setDescription('Enable or disable Deck calendar/tasks integration for all existing users. Users can still change their own setting afterwards. Only affects users that already exist at the time of execution.')
+ ->addOption(
+ 'on',
+ null,
+ InputOption::VALUE_NONE,
+ 'Enable calendar/tasks integration for all existing users (users can opt-out later)'
+ )
+ ->addOption(
+ 'off',
+ null,
+ InputOption::VALUE_NONE,
+ 'Disable calendar/tasks integration for all existing users (users can opt-in later)'
+ );
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ $enable = $input->getOption('on');
+ $disable = $input->getOption('off');
+ if ($enable && $disable) {
+ $output->writeln('Cannot use --on and --off together.');
+ return 1;
+ }
+ if (!$enable && !$disable) {
+ $output->writeln('Please specify either --on or --off.');
+ return 1;
+ }
+ $value = $enable ? 'yes' : '';
+ $users = $this->userManager->search('');
+ $count = 0;
+ foreach ($users as $user) {
+ $uid = $user->getUID();
+ $this->config->setUserValue($uid, 'deck', 'calendar', $value);
+ $output->writeln("Set calendar integration to '" . ($enable ? 'on' : 'off') . "' for user: $uid");
+ $count++;
+ }
+ $output->writeln("Done. Updated $count existing users.");
+ return 0;
+ }
+}