|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Nextcloud - namespace OCA\Nextnote |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2016, Sander Brand ([email protected]) |
|
6
|
|
|
* |
|
7
|
|
|
* @license GNU AGPL version 3 or any later version |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
12
|
|
|
* License, or (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU Affero General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21
|
|
|
* |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
namespace OCA\NextNote\Service; |
|
25
|
|
|
|
|
26
|
|
|
use OCA\NextNote\Db\Notebook; |
|
27
|
|
|
use OCA\NextNote\Db\Note; |
|
28
|
|
|
use OCA\NextNote\Db\ShareMapper; |
|
29
|
|
|
use OCA\NextNote\Fixtures\ExampleNote; |
|
30
|
|
|
use OCA\NextNote\Utility\Utils; |
|
31
|
|
|
use OCA\NextNote\Db\NoteMapper; |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
class ShareService { |
|
35
|
|
|
|
|
36
|
|
|
const PERMISSION_CREATE = 4; |
|
37
|
|
|
const PERMISSION_READ = 1; |
|
38
|
|
|
const PERMISSION_UPDATE = 2; |
|
39
|
|
|
const PERMISSION_DELETE = 8; |
|
40
|
|
|
const PERMISSION_SHARE = 16; |
|
41
|
|
|
const PERMISSION_ALL = 31; |
|
42
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
private $shareMapper; |
|
45
|
|
|
private $utils; |
|
46
|
|
|
private $notebookService; |
|
47
|
|
|
|
|
48
|
|
|
public function __construct(ShareMapper $shareMapper, Utils $utils, NotebookService $notebookService) { |
|
49
|
|
|
$this->shareMapper = $shareMapper; |
|
50
|
|
|
$this->utils = $utils; |
|
51
|
|
|
$this->notebookService = $notebookService; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Get shared notes from a user. |
|
56
|
|
|
* |
|
57
|
|
|
* @param $userId |
|
58
|
|
|
* @param int|bool $deleted |
|
59
|
|
|
* @return Note[] |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getSharedNotesFromUser($userId, $deleted = false) { |
|
|
|
|
|
|
62
|
|
|
// Get shares |
|
63
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.