Completed
Push — master ( 809444...363a27 )
by Maxence
05:40 queued 02:26
created

NavigationController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 55
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A navigate() 0 22 1
A settings() 0 12 1
1
<?php
2
/**
3
 * Circles - Bring cloud-users closer together.
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2017
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
namespace OCA\Circles\Controller;
28
29
use \OCA\Circles\Model\Circle;
30
use OCA\Circles\Service\ConfigService;
31
use OCA\Testing\Config;
32
use OCP\AppFramework\Http;
33
use OCP\AppFramework\Http\DataResponse;
34
use OCP\AppFramework\Http\TemplateResponse;
35
36
class NavigationController extends BaseController {
37
38
39
	/**
40
	 * @NoCSRFRequired
41
	 * @NoAdminRequired
42
	 * @NoSubAdminRequired
43
	 *
44
	 * @return TemplateResponse
45
	 */
46
	public function navigate() {
47
		$data = [
48
			'allowed_circles' => array(
49
				Circle::CIRCLES_PERSONAL => $this->configService->isCircleAllowed(
50
					Circle::CIRCLES_PERSONAL
51
				),
52
				Circle::CIRCLES_HIDDEN   => $this->configService->isCircleAllowed(
53
					Circle::CIRCLES_HIDDEN
54
				),
55
				Circle::CIRCLES_PRIVATE  => $this->configService->isCircleAllowed(
56
					Circle::CIRCLES_PRIVATE
57
				),
58
				Circle::CIRCLES_PUBLIC   => $this->configService->isCircleAllowed(
59
					Circle::CIRCLES_PUBLIC
60
				),
61
			)
62
		];
63
64
		return new TemplateResponse(
65
			'circles', 'navigate', $data
66
		);
67
	}
68
69
70
	/**
71
	 * @NoCSRFRequired
72
	 * @NoAdminRequired
73
	 * @NoSubAdminRequired
74
	 *
75
	 * @return DataResponse
76
	 */
77
	public function settings() {
78
		$data = [
79
			'allowed_federated' => $this->configService->getAppValue(ConfigService::CIRCLES_ALLOW_FEDERATED),
80
			'allowed_circles'   => $this->configService->getAppValue(ConfigService::CIRCLES_ALLOW_CIRCLES),
81
			'status'            => 1
82
		];
83
84
		return new DataResponse(
85
			$data,
86
			Http::STATUS_OK
87
		);
88
	}
89
90
}
91
92
93