1<?php
2/**
3 * @author Bart Visscher <bartv@thisnet.nl>
4 * @author Björn Schießle <bjoern@schiessle.org>
5 * @author Christopher Schäpers <kondou@ts.unde.re>
6 * @author Christoph Wurst <christoph@owncloud.com>
7 * @author Georg Ehrke <georg@owncloud.com>
8 * @author Lukas Reschke <lukas@statuscode.ch>
9 * @author Morris Jobke <hey@morrisjobke.de>
10 * @author Raghu Nayyar <me@iraghu.com>
11 * @author Robin Appelman <icewind@owncloud.com>
12 * @author Roeland Jago Douma <rullzer@owncloud.com>
13 * @author Thomas Müller <thomas.mueller@tmit.eu>
14 * @author Tom Needham <tom@owncloud.com>
15 * @author Vincent Petry <pvince81@owncloud.com>
16 *
17 * @copyright Copyright (c) 2018, ownCloud GmbH
18 * @license AGPL-3.0
19 *
20 * This code is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU Affero General Public License, version 3,
22 * as published by the Free Software Foundation.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU Affero General Public License for more details.
28 *
29 * You should have received a copy of the GNU Affero General Public License, version 3,
30 * along with this program.  If not, see <http://www.gnu.org/licenses/>
31 *
32 */
33
34namespace OC\Settings;
35
36$application = new Application();
37$application->registerRoutes($this, [
38	'resources' => [
39		'groups' => ['url' => '/settings/users/groups'],
40		'users' => ['url' => '/settings/users/users'],
41		'auth_settings' => ['url' => '/settings/personal/authtokens'],
42	],
43	'routes' => [
44		['name' => 'MailSettings#setMailSettings', 'url' => '/settings/admin/mailsettings', 'verb' => 'POST'],
45		['name' => 'MailSettings#storeCredentials', 'url' => '/settings/admin/mailsettings/credentials', 'verb' => 'POST'],
46		['name' => 'MailSettings#sendTestMail', 'url' => '/settings/admin/mailtest', 'verb' => 'POST'],
47		['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET'],
48		['name' => 'Users#setDisplayName', 'url' => '/settings/users/{username}/displayName', 'verb' => 'POST'],
49		['name' => 'Users#setMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT'],
50		['name' => 'Users#setEmailAddress', 'url' => '/settings/admin/{id}/mailAddress', 'verb' => 'PUT'],
51		['name' => 'Users#setEnabled', 'url' => '/settings/users/{id}/enabled', 'verb' => 'POST'],
52		['name' => 'Users#stats', 'url' => '/settings/users/stats', 'verb' => 'GET'],
53		['name' => 'LogSettings#setLogLevel', 'url' => '/settings/admin/log/level', 'verb' => 'POST'],
54		['name' => 'LogSettings#download', 'url' => '/settings/admin/log/download', 'verb' => 'GET'],
55		['name' => 'CheckSetup#check', 'url' => '/settings/ajax/checksetup', 'verb' => 'GET'],
56		['name' => 'CheckSetup#getFailedIntegrityCheckFiles', 'url' => '/settings/integrity/failed', 'verb' => 'GET'],
57		['name' => 'CheckSetup#rescanFailedIntegrityCheck', 'url' => '/settings/integrity/rescan', 'verb' => 'GET'],
58		['name' => 'Certificate#addPersonalRootCertificate', 'url' => '/settings/personal/certificate', 'verb' => 'POST'],
59		['name' => 'Certificate#removePersonalRootCertificate', 'url' => '/settings/personal/certificate/{certificateIdentifier}', 'verb' => 'DELETE'],
60		['name' => 'Certificate#addSystemRootCertificate', 'url' => '/settings/admin/certificate', 'verb' => 'POST'],
61		['name' => 'Certificate#removeSystemRootCertificate', 'url' => '/settings/admin/certificate/{certificateIdentifier}', 'verb' => 'DELETE'],
62		['name' => 'SettingsPage#getPersonal', 'url' => '/settings/personal', 'verb' => 'GET'],
63		['name' => 'SettingsPage#getAdmin', 'url' => '/settings/admin', 'verb' => 'GET'],
64		['name' => 'Users#changeMail', 'url' => '/settings/mailaddress/change/{token}/{userId}', 'verb' => 'GET'],
65		['name' => 'Cors#getDomains', 'url' => '/settings/domains', 'verb' => 'GET'],
66		['name' => 'Cors#addDomain', 'url' => '/settings/domains', 'verb' => 'POST'],
67		['name' => 'Cors#removeDomain', 'url' => '/settings/domains/{domain}', 'verb' => 'DELETE'],
68		['name' => 'LegalSettings#setImprintUrl', 'url' => '/settings/admin/legal/imprint', 'verb' => 'POST'],
69		['name' => 'LegalSettings#setPrivacyPolicyUrl', 'url' => '/settings/admin/legal/privacypolicy', 'verb' => 'POST'],
70		['name' => 'ChangePassword#changePassword', 'url' => '/users/changepassword', 'verb' => 'POST'],
71		['name' => 'Users#setPasswordForm', 'url' => '/settings/users/setpassword/form/{token}/{userId}', 'verb' => 'GET'],
72		['name' => 'Users#resendToken', 'url' => '/resend/token/{userId}', 'verb' => 'POST'],
73		['name' => 'Users#resendInvitation', 'url' => '/resend/invitation/{userId}', 'verb' => 'POST'],
74		['name' => 'Users#setPassword', 'url' => '/setpassword/{token}/{userId}', 'verb' => 'POST'],
75		['name' => 'Groups#getAssignableAndRemovableGroups', 'url' => '/settings/groups/available', 'verb' => 'GET'],
76	]
77]);
78
79/** @var $this \OCP\Route\IRouter */
80
81$this->create('settings_users', '/settings/users')
82	->actionInclude('settings/users.php');
83
84// Settings ajax actions
85// users
86$this->create('settings_ajax_setquota', '/settings/ajax/setquota.php')
87	->actionInclude('settings/ajax/setquota.php');
88$this->create('settings_ajax_togglegroups', '/settings/ajax/togglegroups.php')
89	->actionInclude('settings/ajax/togglegroups.php');
90$this->create('settings_ajax_togglesubadmins', '/settings/ajax/togglesubadmins.php')
91	->actionInclude('settings/ajax/togglesubadmins.php');
92$this->create('settings_users_changepassword', '/settings/users/changepassword')
93	->post()
94	->action('OC\Settings\ChangePassword\Controller', 'changeUserPassword');
95$this->create('settings_ajax_changegroupname', '/settings/ajax/changegroupname.php')
96	->actionInclude('settings/ajax/changegroupname.php');
97// personal
98$this->create('settings_personal_changepassword', '/settings/personal/changepassword')
99	->post()
100	->action('OC\Settings\ChangePassword\Controller', 'changePersonalPassword');
101$this->create('settings_ajax_setlanguage', '/settings/ajax/setlanguage.php')
102	->actionInclude('settings/ajax/setlanguage.php');
103// apps
104$this->create('settings_ajax_enableapp', '/settings/ajax/enableapp.php')
105	->actionInclude('settings/ajax/enableapp.php');
106$this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php')
107	->actionInclude('settings/ajax/disableapp.php');
108$this->create('settings_ajax_updateapp', '/settings/ajax/updateapp.php')
109	->actionInclude('settings/ajax/updateapp.php');
110$this->create('settings_ajax_uninstallapp', '/settings/ajax/uninstallapp.php')
111	->actionInclude('settings/ajax/uninstallapp.php');
112$this->create('settings_ajax_navigationdetect', '/settings/ajax/navigationdetect.php')
113	->actionInclude('settings/ajax/navigationdetect.php');
114// admin
115$this->create('settings_ajax_excludegroups', '/settings/ajax/excludegroups.php')
116	->actionInclude('settings/ajax/excludegroups.php');
117