@@ -34,29 +34,29 @@ |
||
34 | 34 | * @since 15.0.0 |
35 | 35 | */ |
36 | 36 | abstract class TimedJob extends Job { |
37 | - /** @var int */ |
|
38 | - protected $interval = 0; |
|
37 | + /** @var int */ |
|
38 | + protected $interval = 0; |
|
39 | 39 | |
40 | - /** |
|
41 | - * set the interval for the job |
|
42 | - * |
|
43 | - * @since 15.0.0 |
|
44 | - */ |
|
45 | - public function setInterval(int $interval) { |
|
46 | - $this->interval = $interval; |
|
47 | - } |
|
40 | + /** |
|
41 | + * set the interval for the job |
|
42 | + * |
|
43 | + * @since 15.0.0 |
|
44 | + */ |
|
45 | + public function setInterval(int $interval) { |
|
46 | + $this->interval = $interval; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * run the job if the last run is is more than the interval ago |
|
51 | - * |
|
52 | - * @param JobList $jobList |
|
53 | - * @param ILogger|null $logger |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - */ |
|
57 | - final public function execute($jobList, ILogger $logger = null) { |
|
58 | - if (($this->time->getTime() - $this->lastRun) > $this->interval) { |
|
59 | - parent::execute($jobList, $logger); |
|
60 | - } |
|
61 | - } |
|
49 | + /** |
|
50 | + * run the job if the last run is is more than the interval ago |
|
51 | + * |
|
52 | + * @param JobList $jobList |
|
53 | + * @param ILogger|null $logger |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + */ |
|
57 | + final public function execute($jobList, ILogger $logger = null) { |
|
58 | + if (($this->time->getTime() - $this->lastRun) > $this->interval) { |
|
59 | + parent::execute($jobList, $logger); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | } |
@@ -24,33 +24,33 @@ |
||
24 | 24 | use OCP\IUser; |
25 | 25 | |
26 | 26 | interface ITrashManager extends ITrashBackend { |
27 | - /** |
|
28 | - * Add a backend for the trashbin |
|
29 | - * |
|
30 | - * @param string $storageType |
|
31 | - * @param ITrashBackend $backend |
|
32 | - * @since 15.0.0 |
|
33 | - */ |
|
34 | - public function registerBackend(string $storageType, ITrashBackend $backend); |
|
27 | + /** |
|
28 | + * Add a backend for the trashbin |
|
29 | + * |
|
30 | + * @param string $storageType |
|
31 | + * @param ITrashBackend $backend |
|
32 | + * @since 15.0.0 |
|
33 | + */ |
|
34 | + public function registerBackend(string $storageType, ITrashBackend $backend); |
|
35 | 35 | |
36 | - /** |
|
37 | - * List all trash items in the root of the trashbin |
|
38 | - * |
|
39 | - * @param IUser $user |
|
40 | - * @return ITrashItem[] |
|
41 | - * @since 15.0.0 |
|
42 | - */ |
|
43 | - public function listTrashRoot(IUser $user): array; |
|
36 | + /** |
|
37 | + * List all trash items in the root of the trashbin |
|
38 | + * |
|
39 | + * @param IUser $user |
|
40 | + * @return ITrashItem[] |
|
41 | + * @since 15.0.0 |
|
42 | + */ |
|
43 | + public function listTrashRoot(IUser $user): array; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Temporally prevent files from being moved to the trash |
|
47 | - * |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function pauseTrash(); |
|
45 | + /** |
|
46 | + * Temporally prevent files from being moved to the trash |
|
47 | + * |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function pauseTrash(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @since 15.0.0 |
|
54 | - */ |
|
55 | - public function resumeTrash(); |
|
52 | + /** |
|
53 | + * @since 15.0.0 |
|
54 | + */ |
|
55 | + public function resumeTrash(); |
|
56 | 56 | } |
@@ -31,54 +31,54 @@ |
||
31 | 31 | * @since 15.0.0 |
32 | 32 | */ |
33 | 33 | interface ITrashBackend { |
34 | - /** |
|
35 | - * List all trash items in the root of the trashbin |
|
36 | - * |
|
37 | - * @param IUser $user |
|
38 | - * @return ITrashItem[] |
|
39 | - * @since 15.0.0 |
|
40 | - */ |
|
41 | - public function listTrashRoot(IUser $user): array; |
|
34 | + /** |
|
35 | + * List all trash items in the root of the trashbin |
|
36 | + * |
|
37 | + * @param IUser $user |
|
38 | + * @return ITrashItem[] |
|
39 | + * @since 15.0.0 |
|
40 | + */ |
|
41 | + public function listTrashRoot(IUser $user): array; |
|
42 | 42 | |
43 | - /** |
|
44 | - * List all trash items in a subfolder in the trashbin |
|
45 | - * |
|
46 | - * @param ITrashItem $folder |
|
47 | - * @return ITrashItem[] |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function listTrashFolder(ITrashItem $folder): array; |
|
43 | + /** |
|
44 | + * List all trash items in a subfolder in the trashbin |
|
45 | + * |
|
46 | + * @param ITrashItem $folder |
|
47 | + * @return ITrashItem[] |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function listTrashFolder(ITrashItem $folder): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Restore a trashbin item |
|
54 | - * |
|
55 | - * @param ITrashItem $item |
|
56 | - * @since 15.0.0 |
|
57 | - */ |
|
58 | - public function restoreItem(ITrashItem $item); |
|
52 | + /** |
|
53 | + * Restore a trashbin item |
|
54 | + * |
|
55 | + * @param ITrashItem $item |
|
56 | + * @since 15.0.0 |
|
57 | + */ |
|
58 | + public function restoreItem(ITrashItem $item); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Permanently remove an item from trash |
|
62 | - * |
|
63 | - * @param ITrashItem $item |
|
64 | - * @since 15.0.0 |
|
65 | - */ |
|
66 | - public function removeItem(ITrashItem $item); |
|
60 | + /** |
|
61 | + * Permanently remove an item from trash |
|
62 | + * |
|
63 | + * @param ITrashItem $item |
|
64 | + * @since 15.0.0 |
|
65 | + */ |
|
66 | + public function removeItem(ITrashItem $item); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Move a file or folder to trash |
|
70 | - * |
|
71 | - * @param IStorage $storage |
|
72 | - * @param string $internalPath |
|
73 | - * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | - * @since 15.0.0 |
|
75 | - */ |
|
76 | - public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
68 | + /** |
|
69 | + * Move a file or folder to trash |
|
70 | + * |
|
71 | + * @param IStorage $storage |
|
72 | + * @param string $internalPath |
|
73 | + * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | + * @since 15.0.0 |
|
75 | + */ |
|
76 | + public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param IUser $user |
|
80 | - * @param int $fileId |
|
81 | - * @return Node|null |
|
82 | - */ |
|
83 | - public function getTrashNodeById(IUser $user, int $fileId); |
|
78 | + /** |
|
79 | + * @param IUser $user |
|
80 | + * @param int $fileId |
|
81 | + * @return Node|null |
|
82 | + */ |
|
83 | + public function getTrashNodeById(IUser $user, int $fileId); |
|
84 | 84 | } |
@@ -31,69 +31,69 @@ |
||
31 | 31 | use Sabre\DAV\ICollection; |
32 | 32 | |
33 | 33 | class TrashHome implements ICollection { |
34 | - /** @var ITrashManager */ |
|
35 | - private $trashManager; |
|
36 | - |
|
37 | - /** @var array */ |
|
38 | - private $principalInfo; |
|
39 | - |
|
40 | - /** @var IUser */ |
|
41 | - private $user; |
|
42 | - |
|
43 | - public function __construct( |
|
44 | - array $principalInfo, |
|
45 | - ITrashManager $trashManager, |
|
46 | - IUser $user |
|
47 | - ) { |
|
48 | - $this->principalInfo = $principalInfo; |
|
49 | - $this->trashManager = $trashManager; |
|
50 | - $this->user = $user; |
|
51 | - } |
|
52 | - |
|
53 | - public function delete() { |
|
54 | - throw new Forbidden(); |
|
55 | - } |
|
56 | - |
|
57 | - public function getName(): string { |
|
58 | - list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']); |
|
59 | - return $name; |
|
60 | - } |
|
61 | - |
|
62 | - public function setName($name) { |
|
63 | - throw new Forbidden('Permission denied to rename this trashbin'); |
|
64 | - } |
|
65 | - |
|
66 | - public function createFile($name, $data = null) { |
|
67 | - throw new Forbidden('Not allowed to create files in the trashbin'); |
|
68 | - } |
|
69 | - |
|
70 | - public function createDirectory($name) { |
|
71 | - throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
72 | - } |
|
73 | - |
|
74 | - public function getChild($name) { |
|
75 | - if ($name === 'restore') { |
|
76 | - return new RestoreFolder(); |
|
77 | - } |
|
78 | - if ($name === 'trash') { |
|
79 | - return new TrashRoot($this->user, $this->trashManager); |
|
80 | - } |
|
81 | - |
|
82 | - throw new NotFound(); |
|
83 | - } |
|
84 | - |
|
85 | - public function getChildren(): array { |
|
86 | - return [ |
|
87 | - new RestoreFolder(), |
|
88 | - new TrashRoot($this->user, $this->trashManager) |
|
89 | - ]; |
|
90 | - } |
|
91 | - |
|
92 | - public function childExists($name): bool { |
|
93 | - return $name === 'restore' || $name === 'trash'; |
|
94 | - } |
|
95 | - |
|
96 | - public function getLastModified(): int { |
|
97 | - return 0; |
|
98 | - } |
|
34 | + /** @var ITrashManager */ |
|
35 | + private $trashManager; |
|
36 | + |
|
37 | + /** @var array */ |
|
38 | + private $principalInfo; |
|
39 | + |
|
40 | + /** @var IUser */ |
|
41 | + private $user; |
|
42 | + |
|
43 | + public function __construct( |
|
44 | + array $principalInfo, |
|
45 | + ITrashManager $trashManager, |
|
46 | + IUser $user |
|
47 | + ) { |
|
48 | + $this->principalInfo = $principalInfo; |
|
49 | + $this->trashManager = $trashManager; |
|
50 | + $this->user = $user; |
|
51 | + } |
|
52 | + |
|
53 | + public function delete() { |
|
54 | + throw new Forbidden(); |
|
55 | + } |
|
56 | + |
|
57 | + public function getName(): string { |
|
58 | + list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']); |
|
59 | + return $name; |
|
60 | + } |
|
61 | + |
|
62 | + public function setName($name) { |
|
63 | + throw new Forbidden('Permission denied to rename this trashbin'); |
|
64 | + } |
|
65 | + |
|
66 | + public function createFile($name, $data = null) { |
|
67 | + throw new Forbidden('Not allowed to create files in the trashbin'); |
|
68 | + } |
|
69 | + |
|
70 | + public function createDirectory($name) { |
|
71 | + throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
72 | + } |
|
73 | + |
|
74 | + public function getChild($name) { |
|
75 | + if ($name === 'restore') { |
|
76 | + return new RestoreFolder(); |
|
77 | + } |
|
78 | + if ($name === 'trash') { |
|
79 | + return new TrashRoot($this->user, $this->trashManager); |
|
80 | + } |
|
81 | + |
|
82 | + throw new NotFound(); |
|
83 | + } |
|
84 | + |
|
85 | + public function getChildren(): array { |
|
86 | + return [ |
|
87 | + new RestoreFolder(), |
|
88 | + new TrashRoot($this->user, $this->trashManager) |
|
89 | + ]; |
|
90 | + } |
|
91 | + |
|
92 | + public function childExists($name): bool { |
|
93 | + return $name === 'restore' || $name === 'trash'; |
|
94 | + } |
|
95 | + |
|
96 | + public function getLastModified(): int { |
|
97 | + return 0; |
|
98 | + } |
|
99 | 99 | } |
@@ -33,72 +33,72 @@ |
||
33 | 33 | |
34 | 34 | class TrashRoot implements ICollection { |
35 | 35 | |
36 | - /** @var IUser */ |
|
37 | - private $user; |
|
38 | - |
|
39 | - /** @var ITrashManager */ |
|
40 | - private $trashManager; |
|
41 | - |
|
42 | - public function __construct(IUser $user, ITrashManager $trashManager) { |
|
43 | - $this->user = $user; |
|
44 | - $this->trashManager = $trashManager; |
|
45 | - } |
|
46 | - |
|
47 | - public function delete() { |
|
48 | - \OCA\Files_Trashbin\Trashbin::deleteAll(); |
|
49 | - } |
|
50 | - |
|
51 | - public function getName(): string { |
|
52 | - return 'trash'; |
|
53 | - } |
|
54 | - |
|
55 | - public function setName($name) { |
|
56 | - throw new Forbidden('Permission denied to rename this trashbin'); |
|
57 | - } |
|
58 | - |
|
59 | - public function createFile($name, $data = null) { |
|
60 | - throw new Forbidden('Not allowed to create files in the trashbin'); |
|
61 | - } |
|
62 | - |
|
63 | - public function createDirectory($name) { |
|
64 | - throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
65 | - } |
|
66 | - |
|
67 | - public function getChildren(): array { |
|
68 | - $entries = $this->trashManager->listTrashRoot($this->user); |
|
69 | - |
|
70 | - $children = array_map(function (ITrashItem $entry) { |
|
71 | - if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
72 | - return new TrashFolder($this->trashManager, $entry); |
|
73 | - } |
|
74 | - return new TrashFile($this->trashManager, $entry); |
|
75 | - }, $entries); |
|
76 | - |
|
77 | - return $children; |
|
78 | - } |
|
79 | - |
|
80 | - public function getChild($name): ITrash { |
|
81 | - $entries = $this->getChildren(); |
|
82 | - |
|
83 | - foreach ($entries as $entry) { |
|
84 | - if ($entry->getName() === $name) { |
|
85 | - return $entry; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - throw new NotFound(); |
|
90 | - } |
|
91 | - |
|
92 | - public function childExists($name): bool { |
|
93 | - try { |
|
94 | - $this->getChild($name); |
|
95 | - return true; |
|
96 | - } catch (NotFound $e) { |
|
97 | - return false; |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - public function getLastModified(): int { |
|
102 | - return 0; |
|
103 | - } |
|
36 | + /** @var IUser */ |
|
37 | + private $user; |
|
38 | + |
|
39 | + /** @var ITrashManager */ |
|
40 | + private $trashManager; |
|
41 | + |
|
42 | + public function __construct(IUser $user, ITrashManager $trashManager) { |
|
43 | + $this->user = $user; |
|
44 | + $this->trashManager = $trashManager; |
|
45 | + } |
|
46 | + |
|
47 | + public function delete() { |
|
48 | + \OCA\Files_Trashbin\Trashbin::deleteAll(); |
|
49 | + } |
|
50 | + |
|
51 | + public function getName(): string { |
|
52 | + return 'trash'; |
|
53 | + } |
|
54 | + |
|
55 | + public function setName($name) { |
|
56 | + throw new Forbidden('Permission denied to rename this trashbin'); |
|
57 | + } |
|
58 | + |
|
59 | + public function createFile($name, $data = null) { |
|
60 | + throw new Forbidden('Not allowed to create files in the trashbin'); |
|
61 | + } |
|
62 | + |
|
63 | + public function createDirectory($name) { |
|
64 | + throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
65 | + } |
|
66 | + |
|
67 | + public function getChildren(): array { |
|
68 | + $entries = $this->trashManager->listTrashRoot($this->user); |
|
69 | + |
|
70 | + $children = array_map(function (ITrashItem $entry) { |
|
71 | + if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
72 | + return new TrashFolder($this->trashManager, $entry); |
|
73 | + } |
|
74 | + return new TrashFile($this->trashManager, $entry); |
|
75 | + }, $entries); |
|
76 | + |
|
77 | + return $children; |
|
78 | + } |
|
79 | + |
|
80 | + public function getChild($name): ITrash { |
|
81 | + $entries = $this->getChildren(); |
|
82 | + |
|
83 | + foreach ($entries as $entry) { |
|
84 | + if ($entry->getName() === $name) { |
|
85 | + return $entry; |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + throw new NotFound(); |
|
90 | + } |
|
91 | + |
|
92 | + public function childExists($name): bool { |
|
93 | + try { |
|
94 | + $this->getChild($name); |
|
95 | + return true; |
|
96 | + } catch (NotFound $e) { |
|
97 | + return false; |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + public function getLastModified(): int { |
|
102 | + return 0; |
|
103 | + } |
|
104 | 104 | } |
@@ -29,49 +29,49 @@ |
||
29 | 29 | use Sabre\DAV\ICollection; |
30 | 30 | |
31 | 31 | abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, ITrash { |
32 | - public function getChildren(): array { |
|
33 | - $entries = $this->trashManager->listTrashFolder($this->data); |
|
32 | + public function getChildren(): array { |
|
33 | + $entries = $this->trashManager->listTrashFolder($this->data); |
|
34 | 34 | |
35 | - $children = array_map(function (ITrashItem $entry) { |
|
36 | - if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
37 | - return new TrashFolderFolder($this->trashManager, $entry); |
|
38 | - } |
|
39 | - return new TrashFolderFile($this->trashManager, $entry); |
|
40 | - }, $entries); |
|
35 | + $children = array_map(function (ITrashItem $entry) { |
|
36 | + if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
37 | + return new TrashFolderFolder($this->trashManager, $entry); |
|
38 | + } |
|
39 | + return new TrashFolderFile($this->trashManager, $entry); |
|
40 | + }, $entries); |
|
41 | 41 | |
42 | - return $children; |
|
43 | - } |
|
42 | + return $children; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getChild($name): ITrash { |
|
46 | - $entries = $this->getChildren(); |
|
45 | + public function getChild($name): ITrash { |
|
46 | + $entries = $this->getChildren(); |
|
47 | 47 | |
48 | - foreach ($entries as $entry) { |
|
49 | - if ($entry->getName() === $name) { |
|
50 | - return $entry; |
|
51 | - } |
|
52 | - } |
|
48 | + foreach ($entries as $entry) { |
|
49 | + if ($entry->getName() === $name) { |
|
50 | + return $entry; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - throw new NotFound(); |
|
55 | - } |
|
54 | + throw new NotFound(); |
|
55 | + } |
|
56 | 56 | |
57 | - public function childExists($name): bool { |
|
58 | - try { |
|
59 | - $this->getChild($name); |
|
60 | - return true; |
|
61 | - } catch (NotFound $e) { |
|
62 | - return false; |
|
63 | - } |
|
64 | - } |
|
57 | + public function childExists($name): bool { |
|
58 | + try { |
|
59 | + $this->getChild($name); |
|
60 | + return true; |
|
61 | + } catch (NotFound $e) { |
|
62 | + return false; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - public function setName($name) { |
|
67 | - throw new Forbidden(); |
|
68 | - } |
|
66 | + public function setName($name) { |
|
67 | + throw new Forbidden(); |
|
68 | + } |
|
69 | 69 | |
70 | - public function createFile($name, $data = null) { |
|
71 | - throw new Forbidden(); |
|
72 | - } |
|
70 | + public function createFile($name, $data = null) { |
|
71 | + throw new Forbidden(); |
|
72 | + } |
|
73 | 73 | |
74 | - public function createDirectory($name) { |
|
75 | - throw new Forbidden(); |
|
76 | - } |
|
74 | + public function createDirectory($name) { |
|
75 | + throw new Forbidden(); |
|
76 | + } |
|
77 | 77 | } |
@@ -31,41 +31,41 @@ |
||
31 | 31 | use Sabre\DAVACL\PrincipalBackend; |
32 | 32 | |
33 | 33 | class RootCollection extends AbstractPrincipalCollection { |
34 | - /** @var ITrashManager */ |
|
35 | - private $trashManager; |
|
34 | + /** @var ITrashManager */ |
|
35 | + private $trashManager; |
|
36 | 36 | |
37 | - public function __construct( |
|
38 | - ITrashManager $trashManager, |
|
39 | - PrincipalBackend\BackendInterface $principalBackend, |
|
40 | - IConfig $config |
|
41 | - ) { |
|
42 | - parent::__construct($principalBackend, 'principals/users'); |
|
37 | + public function __construct( |
|
38 | + ITrashManager $trashManager, |
|
39 | + PrincipalBackend\BackendInterface $principalBackend, |
|
40 | + IConfig $config |
|
41 | + ) { |
|
42 | + parent::__construct($principalBackend, 'principals/users'); |
|
43 | 43 | |
44 | - $this->trashManager = $trashManager; |
|
45 | - $this->disableListing = !$config->getSystemValue('debug', false); |
|
46 | - } |
|
44 | + $this->trashManager = $trashManager; |
|
45 | + $this->disableListing = !$config->getSystemValue('debug', false); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * This method returns a node for a principal. |
|
50 | - * |
|
51 | - * The passed array contains principal information, and is guaranteed to |
|
52 | - * at least contain a uri item. Other properties may or may not be |
|
53 | - * supplied by the authentication backend. |
|
54 | - * |
|
55 | - * @param array $principalInfo |
|
56 | - * @return INode |
|
57 | - */ |
|
58 | - public function getChildForPrincipal(array $principalInfo): TrashHome { |
|
59 | - list(, $name) = \Sabre\Uri\split($principalInfo['uri']); |
|
60 | - $user = \OC::$server->getUserSession()->getUser(); |
|
61 | - if (is_null($user) || $name !== $user->getUID()) { |
|
62 | - throw new \Sabre\DAV\Exception\Forbidden(); |
|
63 | - } |
|
64 | - return new TrashHome($principalInfo, $this->trashManager, $user); |
|
65 | - } |
|
48 | + /** |
|
49 | + * This method returns a node for a principal. |
|
50 | + * |
|
51 | + * The passed array contains principal information, and is guaranteed to |
|
52 | + * at least contain a uri item. Other properties may or may not be |
|
53 | + * supplied by the authentication backend. |
|
54 | + * |
|
55 | + * @param array $principalInfo |
|
56 | + * @return INode |
|
57 | + */ |
|
58 | + public function getChildForPrincipal(array $principalInfo): TrashHome { |
|
59 | + list(, $name) = \Sabre\Uri\split($principalInfo['uri']); |
|
60 | + $user = \OC::$server->getUserSession()->getUser(); |
|
61 | + if (is_null($user) || $name !== $user->getUID()) { |
|
62 | + throw new \Sabre\DAV\Exception\Forbidden(); |
|
63 | + } |
|
64 | + return new TrashHome($principalInfo, $this->trashManager, $user); |
|
65 | + } |
|
66 | 66 | |
67 | - public function getName(): string { |
|
68 | - return 'trashbin'; |
|
69 | - } |
|
67 | + public function getName(): string { |
|
68 | + return 'trashbin'; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | } |
@@ -25,11 +25,11 @@ |
||
25 | 25 | namespace OCA\Files_Trashbin\Sabre; |
26 | 26 | |
27 | 27 | class TrashFile extends AbstractTrashFile { |
28 | - public function get() { |
|
29 | - return $this->data->getStorage()->fopen($this->data->getInternalPath() . '.d' . $this->getLastModified(), 'rb'); |
|
30 | - } |
|
28 | + public function get() { |
|
29 | + return $this->data->getStorage()->fopen($this->data->getInternalPath() . '.d' . $this->getLastModified(), 'rb'); |
|
30 | + } |
|
31 | 31 | |
32 | - public function getName(): string { |
|
33 | - return $this->data->getName() . '.d' . $this->getLastModified(); |
|
34 | - } |
|
32 | + public function getName(): string { |
|
33 | + return $this->data->getName() . '.d' . $this->getLastModified(); |
|
34 | + } |
|
35 | 35 | } |
@@ -36,57 +36,57 @@ |
||
36 | 36 | */ |
37 | 37 | interface IAccount extends \JsonSerializable { |
38 | 38 | |
39 | - /** |
|
40 | - * Set a property with data |
|
41 | - * |
|
42 | - * @since 15.0.0 |
|
43 | - * |
|
44 | - * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
45 | - * @param string $value |
|
46 | - * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
47 | - * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED |
|
48 | - * @return IAccount |
|
49 | - */ |
|
50 | - public function setProperty(string $property, string $value, string $scope, string $verified): IAccount; |
|
39 | + /** |
|
40 | + * Set a property with data |
|
41 | + * |
|
42 | + * @since 15.0.0 |
|
43 | + * |
|
44 | + * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
45 | + * @param string $value |
|
46 | + * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
47 | + * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED |
|
48 | + * @return IAccount |
|
49 | + */ |
|
50 | + public function setProperty(string $property, string $value, string $scope, string $verified): IAccount; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get a property by its key |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - * |
|
57 | - * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
58 | - * @return IAccountProperty |
|
59 | - * @throws PropertyDoesNotExistException |
|
60 | - */ |
|
61 | - public function getProperty(string $property): IAccountProperty; |
|
52 | + /** |
|
53 | + * Get a property by its key |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + * |
|
57 | + * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
58 | + * @return IAccountProperty |
|
59 | + * @throws PropertyDoesNotExistException |
|
60 | + */ |
|
61 | + public function getProperty(string $property): IAccountProperty; |
|
62 | 62 | |
63 | - /** |
|
64 | - * Get all properties of an account |
|
65 | - * |
|
66 | - * @since 15.0.0 |
|
67 | - * |
|
68 | - * @return IAccountProperty[] |
|
69 | - */ |
|
70 | - public function getProperties(): array; |
|
63 | + /** |
|
64 | + * Get all properties of an account |
|
65 | + * |
|
66 | + * @since 15.0.0 |
|
67 | + * |
|
68 | + * @return IAccountProperty[] |
|
69 | + */ |
|
70 | + public function getProperties(): array; |
|
71 | 71 | |
72 | - /** |
|
73 | - * Get all properties that match the provided filters for scope and verification status |
|
74 | - * |
|
75 | - * @since 15.0.0 |
|
76 | - * |
|
77 | - * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
78 | - * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED |
|
79 | - * @return IAccountProperty[] |
|
80 | - */ |
|
81 | - public function getFilteredProperties(string $scope = null, string $verified = null): array; |
|
72 | + /** |
|
73 | + * Get all properties that match the provided filters for scope and verification status |
|
74 | + * |
|
75 | + * @since 15.0.0 |
|
76 | + * |
|
77 | + * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager |
|
78 | + * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED |
|
79 | + * @return IAccountProperty[] |
|
80 | + */ |
|
81 | + public function getFilteredProperties(string $scope = null, string $verified = null): array; |
|
82 | 82 | |
83 | - /** |
|
84 | - * Get the related user for the account data |
|
85 | - * |
|
86 | - * @since 15.0.0 |
|
87 | - * |
|
88 | - * @return IUser |
|
89 | - */ |
|
90 | - public function getUser(): IUser; |
|
83 | + /** |
|
84 | + * Get the related user for the account data |
|
85 | + * |
|
86 | + * @since 15.0.0 |
|
87 | + * |
|
88 | + * @return IUser |
|
89 | + */ |
|
90 | + public function getUser(): IUser; |
|
91 | 91 | |
92 | 92 | } |