securitysettingscontroller.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @author Lukas Reschke
  4. * @copyright 2014 Lukas Reschke lukas@owncloud.com
  5. *
  6. * This file is licensed under the Affero General Public License version 3 or
  7. * later.
  8. * See the COPYING-README file.
  9. */
  10. namespace OC\Settings\Controller;
  11. use \OCP\AppFramework\Controller;
  12. use OCP\IRequest;
  13. use OCP\IConfig;
  14. /**
  15. * @package OC\Settings\Controller
  16. */
  17. class SecuritySettingsController extends Controller {
  18. /** @var \OCP\IConfig */
  19. private $config;
  20. /**
  21. * @param string $appName
  22. * @param IRequest $request
  23. * @param IConfig $config
  24. */
  25. public function __construct($appName,
  26. IRequest $request,
  27. IConfig $config) {
  28. parent::__construct($appName, $request);
  29. $this->config = $config;
  30. }
  31. /**
  32. * @return array
  33. */
  34. protected function returnSuccess() {
  35. return array(
  36. 'status' => 'success'
  37. );
  38. }
  39. /**
  40. * Add a new trusted domain
  41. * @param string $newTrustedDomain The newly to add trusted domain
  42. * @return array
  43. */
  44. public function trustedDomains($newTrustedDomain) {
  45. $trustedDomains = $this->config->getSystemValue('trusted_domains');
  46. $trustedDomains[] = $newTrustedDomain;
  47. $this->config->setSystemValue('trusted_domains', $trustedDomains);
  48. return $this->returnSuccess();
  49. }
  50. }