You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemoveCertificate.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Core\Command\Security;
  8. use OC\Core\Command\Base;
  9. use OCP\ICertificateManager;
  10. use Symfony\Component\Console\Input\InputArgument;
  11. use Symfony\Component\Console\Input\InputInterface;
  12. use Symfony\Component\Console\Output\OutputInterface;
  13. class RemoveCertificate extends Base {
  14. public function __construct(
  15. protected ICertificateManager $certificateManager,
  16. ) {
  17. parent::__construct();
  18. }
  19. protected function configure() {
  20. $this
  21. ->setName('security:certificates:remove')
  22. ->setDescription('remove trusted certificate')
  23. ->addArgument(
  24. 'name',
  25. InputArgument::REQUIRED,
  26. 'the file name of the certificate to remove'
  27. );
  28. }
  29. protected function execute(InputInterface $input, OutputInterface $output): int {
  30. $name = $input->getArgument('name');
  31. $this->certificateManager->removeCertificate($name);
  32. return 0;
  33. }
  34. }