Completed
Branch master (8ca3ab)
by Sander
03:07
created

PageController::publicSharePage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Nextcloud - passman
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Sander Brand <[email protected]>
9
 * @copyright Sander Brand 2016
10
 */
11
12
namespace OCA\Passman\Controller;
13
14
use OCP\IRequest;
15
use OCP\AppFramework\Http\TemplateResponse;
16
use OCP\AppFramework\Http\DataResponse;
17
use OCP\AppFramework\Controller;
18
19
class PageController extends Controller {
20
21
22
	private $userId;
23
24
	public function __construct($AppName, IRequest $request, $UserId){
25
		parent::__construct($AppName, $request);
26
		$this->userId = $UserId;
27
	}
28
29
	/**
30
	 * CAUTION: the @Stuff turns off security checks; for this page no admin is
31
	 *          required and no CSRF check. If you don't know what CSRF is, read
32
	 *          it up in the docs or you might create a security hole. This is
33
	 *          basically the only required method to add this exemption, don't
34
	 *          add it to any other method if you don't exactly know what it does
35
	 *
36
	 * @NoAdminRequired
37
	 * @NoCSRFRequired
38
	 */
39 1
	public function index() {
40 1
		$params = ['user' => $this->userId];
41 1
		return new TemplateResponse('passman', 'main', $params);  // templates/main.php
42
	}
43
44
45
	/**
46
	 * @NoAdminRequired
47
	 * @NoCSRFRequired
48
	 */
49 1
	public function bookmarklet($url='',$title='') {
50 1
		$params = array('url' => $url, 'title' => $title);
51 1
		return new TemplateResponse('passman', 'bookmarklet', $params);
52
	}
53
54
	/**
55
	 * @NoAdminRequired
56
	 * @NoCSRFRequired
57
	 * @PublicPage
58
	 */
59 1
	public function publicSharePage() {
60 1
		return new TemplateResponse('passman', 'public_share');
61
	}
62
63
}