-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathTimezoneController.php
More file actions
40 lines (33 loc) · 902 Bytes
/
TimezoneController.php
File metadata and controls
40 lines (33 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\User_SAML\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig;
use OCP\IRequest;
use OCP\ISession;
class TimezoneController extends Controller {
public function __construct(
$appName,
IRequest $request,
private IConfig $config,
private $userId,
private ISession $session,
) {
parent::__construct($appName, $request);
}
/**
* @NoAdminRequired
* @UseSession
* @throws \OCP\PreConditionNotMetException
*/
public function setTimezone(string $timezone, int $timezoneOffset): JSONResponse {
$this->config->setUserValue($this->userId, 'core', 'timezone', $timezone);
$this->session->set('timezone', $timezoneOffset);
return new JSONResponse();
}
}