@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $user = $input->getArgument('uid'); |
97 | 97 | if (!$this->userManager->userExists($user)) { |
98 | 98 | throw new \InvalidArgumentException( |
99 | - 'User <' . $user . '> is unknown.'); |
|
99 | + 'User <'.$user.'> is unknown.'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $birthday = $input->getOption('birthday'); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $calendarInfo = $this->calDav->getCalendarByUri( |
115 | - 'principals/users/' . $user, |
|
115 | + 'principals/users/'.$user, |
|
116 | 116 | $name); |
117 | 117 | if ($calendarInfo === null) { |
118 | 118 | throw new \InvalidArgumentException( |
119 | - 'User <' . $user . '> has no calendar named <' . $name . '>. You can run occ dav:list-calendars to list calendars URIs for this user.'); |
|
119 | + 'User <'.$user.'> has no calendar named <'.$name.'>. You can run occ dav:list-calendars to list calendars URIs for this user.'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $calendar = new Calendar( |
@@ -22,82 +22,82 @@ |
||
22 | 22 | use Symfony\Component\Console\Output\OutputInterface; |
23 | 23 | |
24 | 24 | class DeleteCalendar extends Command { |
25 | - public function __construct( |
|
26 | - private CalDavBackend $calDav, |
|
27 | - private IConfig $config, |
|
28 | - private IL10N $l10n, |
|
29 | - private IUserManager $userManager, |
|
30 | - private LoggerInterface $logger, |
|
31 | - ) { |
|
32 | - parent::__construct(); |
|
33 | - } |
|
25 | + public function __construct( |
|
26 | + private CalDavBackend $calDav, |
|
27 | + private IConfig $config, |
|
28 | + private IL10N $l10n, |
|
29 | + private IUserManager $userManager, |
|
30 | + private LoggerInterface $logger, |
|
31 | + ) { |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | 34 | |
35 | - protected function configure(): void { |
|
36 | - $this |
|
37 | - ->setName('dav:delete-calendar') |
|
38 | - ->setDescription('Delete a dav calendar') |
|
39 | - ->addArgument('uid', |
|
40 | - InputArgument::REQUIRED, |
|
41 | - 'User who owns the calendar') |
|
42 | - ->addArgument('name', |
|
43 | - InputArgument::OPTIONAL, |
|
44 | - 'Name of the calendar to delete') |
|
45 | - ->addOption('birthday', |
|
46 | - null, |
|
47 | - InputOption::VALUE_NONE, |
|
48 | - 'Delete the birthday calendar') |
|
49 | - ->addOption('force', |
|
50 | - 'f', |
|
51 | - InputOption::VALUE_NONE, |
|
52 | - 'Force delete skipping trashbin'); |
|
53 | - } |
|
35 | + protected function configure(): void { |
|
36 | + $this |
|
37 | + ->setName('dav:delete-calendar') |
|
38 | + ->setDescription('Delete a dav calendar') |
|
39 | + ->addArgument('uid', |
|
40 | + InputArgument::REQUIRED, |
|
41 | + 'User who owns the calendar') |
|
42 | + ->addArgument('name', |
|
43 | + InputArgument::OPTIONAL, |
|
44 | + 'Name of the calendar to delete') |
|
45 | + ->addOption('birthday', |
|
46 | + null, |
|
47 | + InputOption::VALUE_NONE, |
|
48 | + 'Delete the birthday calendar') |
|
49 | + ->addOption('force', |
|
50 | + 'f', |
|
51 | + InputOption::VALUE_NONE, |
|
52 | + 'Force delete skipping trashbin'); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function execute( |
|
56 | - InputInterface $input, |
|
57 | - OutputInterface $output, |
|
58 | - ): int { |
|
59 | - /** @var string $user */ |
|
60 | - $user = $input->getArgument('uid'); |
|
61 | - if (!$this->userManager->userExists($user)) { |
|
62 | - throw new \InvalidArgumentException( |
|
63 | - 'User <' . $user . '> is unknown.'); |
|
64 | - } |
|
55 | + protected function execute( |
|
56 | + InputInterface $input, |
|
57 | + OutputInterface $output, |
|
58 | + ): int { |
|
59 | + /** @var string $user */ |
|
60 | + $user = $input->getArgument('uid'); |
|
61 | + if (!$this->userManager->userExists($user)) { |
|
62 | + throw new \InvalidArgumentException( |
|
63 | + 'User <' . $user . '> is unknown.'); |
|
64 | + } |
|
65 | 65 | |
66 | - $birthday = $input->getOption('birthday'); |
|
67 | - if ($birthday !== false) { |
|
68 | - $name = BirthdayService::BIRTHDAY_CALENDAR_URI; |
|
69 | - } else { |
|
70 | - /** @var string $name */ |
|
71 | - $name = $input->getArgument('name'); |
|
72 | - if (!$name) { |
|
73 | - throw new \InvalidArgumentException( |
|
74 | - 'Please specify a calendar name or --birthday'); |
|
75 | - } |
|
76 | - } |
|
66 | + $birthday = $input->getOption('birthday'); |
|
67 | + if ($birthday !== false) { |
|
68 | + $name = BirthdayService::BIRTHDAY_CALENDAR_URI; |
|
69 | + } else { |
|
70 | + /** @var string $name */ |
|
71 | + $name = $input->getArgument('name'); |
|
72 | + if (!$name) { |
|
73 | + throw new \InvalidArgumentException( |
|
74 | + 'Please specify a calendar name or --birthday'); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - $calendarInfo = $this->calDav->getCalendarByUri( |
|
79 | - 'principals/users/' . $user, |
|
80 | - $name); |
|
81 | - if ($calendarInfo === null) { |
|
82 | - throw new \InvalidArgumentException( |
|
83 | - 'User <' . $user . '> has no calendar named <' . $name . '>. You can run occ dav:list-calendars to list calendars URIs for this user.'); |
|
84 | - } |
|
78 | + $calendarInfo = $this->calDav->getCalendarByUri( |
|
79 | + 'principals/users/' . $user, |
|
80 | + $name); |
|
81 | + if ($calendarInfo === null) { |
|
82 | + throw new \InvalidArgumentException( |
|
83 | + 'User <' . $user . '> has no calendar named <' . $name . '>. You can run occ dav:list-calendars to list calendars URIs for this user.'); |
|
84 | + } |
|
85 | 85 | |
86 | - $calendar = new Calendar( |
|
87 | - $this->calDav, |
|
88 | - $calendarInfo, |
|
89 | - $this->l10n, |
|
90 | - $this->config, |
|
91 | - $this->logger |
|
92 | - ); |
|
86 | + $calendar = new Calendar( |
|
87 | + $this->calDav, |
|
88 | + $calendarInfo, |
|
89 | + $this->l10n, |
|
90 | + $this->config, |
|
91 | + $this->logger |
|
92 | + ); |
|
93 | 93 | |
94 | - $force = $input->getOption('force'); |
|
95 | - if ($force) { |
|
96 | - $calendar->disableTrashbin(); |
|
97 | - } |
|
94 | + $force = $input->getOption('force'); |
|
95 | + if ($force) { |
|
96 | + $calendar->disableTrashbin(); |
|
97 | + } |
|
98 | 98 | |
99 | - $calendar->delete(); |
|
99 | + $calendar->delete(); |
|
100 | 100 | |
101 | - return self::SUCCESS; |
|
102 | - } |
|
101 | + return self::SUCCESS; |
|
102 | + } |
|
103 | 103 | } |
@@ -33,108 +33,108 @@ |
||
33 | 33 | use OCP\Files\Search\ISearchQuery; |
34 | 34 | |
35 | 35 | class NullCache implements ICache { |
36 | - public function getNumericStorageId() { |
|
37 | - return -1; |
|
38 | - } |
|
39 | - |
|
40 | - public function get($file) { |
|
41 | - return $file !== '' ? null : |
|
42 | - new CacheEntry([ |
|
43 | - 'fileid' => -1, |
|
44 | - 'parent' => -1, |
|
45 | - 'name' => '', |
|
46 | - 'path' => '', |
|
47 | - 'size' => '0', |
|
48 | - 'mtime' => time(), |
|
49 | - 'storage_mtime' => time(), |
|
50 | - 'etag' => '', |
|
51 | - 'mimetype' => FileInfo::MIMETYPE_FOLDER, |
|
52 | - 'mimepart' => 'httpd', |
|
53 | - 'permissions' => Constants::PERMISSION_READ |
|
54 | - ]); |
|
55 | - } |
|
56 | - |
|
57 | - public function getFolderContents($folder) { |
|
58 | - return []; |
|
59 | - } |
|
60 | - |
|
61 | - public function getFolderContentsById($fileId) { |
|
62 | - return []; |
|
63 | - } |
|
64 | - |
|
65 | - public function put($file, array $data) { |
|
66 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
67 | - } |
|
68 | - |
|
69 | - public function insert($file, array $data) { |
|
70 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
71 | - } |
|
72 | - |
|
73 | - public function update($id, array $data) { |
|
74 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
75 | - } |
|
76 | - |
|
77 | - public function getId($file) { |
|
78 | - return -1; |
|
79 | - } |
|
80 | - |
|
81 | - public function getParentId($file) { |
|
82 | - return -1; |
|
83 | - } |
|
84 | - |
|
85 | - public function inCache($file) { |
|
86 | - return $file === ''; |
|
87 | - } |
|
88 | - |
|
89 | - public function remove($file) { |
|
90 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
91 | - } |
|
92 | - |
|
93 | - public function move($source, $target) { |
|
94 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
95 | - } |
|
96 | - |
|
97 | - public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { |
|
98 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
99 | - } |
|
100 | - |
|
101 | - public function getStatus($file) { |
|
102 | - return ICache::COMPLETE; |
|
103 | - } |
|
104 | - |
|
105 | - public function search($pattern) { |
|
106 | - return []; |
|
107 | - } |
|
108 | - |
|
109 | - public function searchByMime($mimetype) { |
|
110 | - return []; |
|
111 | - } |
|
112 | - |
|
113 | - public function searchQuery(ISearchQuery $query) { |
|
114 | - return []; |
|
115 | - } |
|
116 | - |
|
117 | - public function getIncomplete() { |
|
118 | - return []; |
|
119 | - } |
|
120 | - |
|
121 | - public function getPathById($id) { |
|
122 | - return ''; |
|
123 | - } |
|
124 | - |
|
125 | - public function normalize($path) { |
|
126 | - return $path; |
|
127 | - } |
|
128 | - |
|
129 | - public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { |
|
130 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
131 | - } |
|
132 | - |
|
133 | - public function getQueryFilterForStorage(): ISearchOperator { |
|
134 | - return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', -1); |
|
135 | - } |
|
136 | - |
|
137 | - public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { |
|
138 | - return null; |
|
139 | - } |
|
36 | + public function getNumericStorageId() { |
|
37 | + return -1; |
|
38 | + } |
|
39 | + |
|
40 | + public function get($file) { |
|
41 | + return $file !== '' ? null : |
|
42 | + new CacheEntry([ |
|
43 | + 'fileid' => -1, |
|
44 | + 'parent' => -1, |
|
45 | + 'name' => '', |
|
46 | + 'path' => '', |
|
47 | + 'size' => '0', |
|
48 | + 'mtime' => time(), |
|
49 | + 'storage_mtime' => time(), |
|
50 | + 'etag' => '', |
|
51 | + 'mimetype' => FileInfo::MIMETYPE_FOLDER, |
|
52 | + 'mimepart' => 'httpd', |
|
53 | + 'permissions' => Constants::PERMISSION_READ |
|
54 | + ]); |
|
55 | + } |
|
56 | + |
|
57 | + public function getFolderContents($folder) { |
|
58 | + return []; |
|
59 | + } |
|
60 | + |
|
61 | + public function getFolderContentsById($fileId) { |
|
62 | + return []; |
|
63 | + } |
|
64 | + |
|
65 | + public function put($file, array $data) { |
|
66 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
67 | + } |
|
68 | + |
|
69 | + public function insert($file, array $data) { |
|
70 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
71 | + } |
|
72 | + |
|
73 | + public function update($id, array $data) { |
|
74 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
75 | + } |
|
76 | + |
|
77 | + public function getId($file) { |
|
78 | + return -1; |
|
79 | + } |
|
80 | + |
|
81 | + public function getParentId($file) { |
|
82 | + return -1; |
|
83 | + } |
|
84 | + |
|
85 | + public function inCache($file) { |
|
86 | + return $file === ''; |
|
87 | + } |
|
88 | + |
|
89 | + public function remove($file) { |
|
90 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
91 | + } |
|
92 | + |
|
93 | + public function move($source, $target) { |
|
94 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
95 | + } |
|
96 | + |
|
97 | + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { |
|
98 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
99 | + } |
|
100 | + |
|
101 | + public function getStatus($file) { |
|
102 | + return ICache::COMPLETE; |
|
103 | + } |
|
104 | + |
|
105 | + public function search($pattern) { |
|
106 | + return []; |
|
107 | + } |
|
108 | + |
|
109 | + public function searchByMime($mimetype) { |
|
110 | + return []; |
|
111 | + } |
|
112 | + |
|
113 | + public function searchQuery(ISearchQuery $query) { |
|
114 | + return []; |
|
115 | + } |
|
116 | + |
|
117 | + public function getIncomplete() { |
|
118 | + return []; |
|
119 | + } |
|
120 | + |
|
121 | + public function getPathById($id) { |
|
122 | + return ''; |
|
123 | + } |
|
124 | + |
|
125 | + public function normalize($path) { |
|
126 | + return $path; |
|
127 | + } |
|
128 | + |
|
129 | + public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { |
|
130 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
131 | + } |
|
132 | + |
|
133 | + public function getQueryFilterForStorage(): ISearchOperator { |
|
134 | + return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', -1); |
|
135 | + } |
|
136 | + |
|
137 | + public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry { |
|
138 | + return null; |
|
139 | + } |
|
140 | 140 | } |
@@ -29,38 +29,38 @@ |
||
29 | 29 | |
30 | 30 | |
31 | 31 | $this->create('files_external_oauth1', 'apps/files_external/ajax/oauth1.php') |
32 | - ->actionInclude('files_external/ajax/oauth1.php'); |
|
32 | + ->actionInclude('files_external/ajax/oauth1.php'); |
|
33 | 33 | $this->create('files_external_oauth2', 'apps/files_external/ajax/oauth2.php') |
34 | - ->actionInclude('files_external/ajax/oauth2.php'); |
|
34 | + ->actionInclude('files_external/ajax/oauth2.php'); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | $this->create('files_external_list_applicable', '/apps/files_external/applicable') |
38 | - ->actionInclude('files_external/ajax/applicable.php'); |
|
38 | + ->actionInclude('files_external/ajax/applicable.php'); |
|
39 | 39 | |
40 | 40 | return [ |
41 | - 'resources' => [ |
|
42 | - 'global_storages' => ['url' => '/globalstorages'], |
|
43 | - 'user_storages' => ['url' => '/userstorages'], |
|
44 | - 'user_global_storages' => ['url' => '/userglobalstorages'], |
|
45 | - ], |
|
46 | - 'routes' => [ |
|
47 | - [ |
|
48 | - 'name' => 'Ajax#getSshKeys', |
|
49 | - 'url' => '/ajax/public_key.php', |
|
50 | - 'verb' => 'POST', |
|
51 | - 'requirements' => [], |
|
52 | - ], |
|
53 | - [ |
|
54 | - 'name' => 'Ajax#saveGlobalCredentials', |
|
55 | - 'url' => '/globalcredentials', |
|
56 | - 'verb' => 'POST', |
|
57 | - ], |
|
58 | - ], |
|
59 | - 'ocs' => [ |
|
60 | - [ |
|
61 | - 'name' => 'Api#getUserMounts', |
|
62 | - 'url' => '/api/v1/mounts', |
|
63 | - 'verb' => 'GET', |
|
64 | - ], |
|
65 | - ], |
|
41 | + 'resources' => [ |
|
42 | + 'global_storages' => ['url' => '/globalstorages'], |
|
43 | + 'user_storages' => ['url' => '/userstorages'], |
|
44 | + 'user_global_storages' => ['url' => '/userglobalstorages'], |
|
45 | + ], |
|
46 | + 'routes' => [ |
|
47 | + [ |
|
48 | + 'name' => 'Ajax#getSshKeys', |
|
49 | + 'url' => '/ajax/public_key.php', |
|
50 | + 'verb' => 'POST', |
|
51 | + 'requirements' => [], |
|
52 | + ], |
|
53 | + [ |
|
54 | + 'name' => 'Ajax#saveGlobalCredentials', |
|
55 | + 'url' => '/globalcredentials', |
|
56 | + 'verb' => 'POST', |
|
57 | + ], |
|
58 | + ], |
|
59 | + 'ocs' => [ |
|
60 | + [ |
|
61 | + 'name' => 'Api#getUserMounts', |
|
62 | + 'url' => '/api/v1/mounts', |
|
63 | + 'verb' => 'GET', |
|
64 | + ], |
|
65 | + ], |
|
66 | 66 | ]; |
@@ -34,67 +34,67 @@ |
||
34 | 34 | * @template-extends QBMapper<PublicKeyCredentialEntity> |
35 | 35 | */ |
36 | 36 | class PublicKeyCredentialMapper extends QBMapper { |
37 | - public function __construct(IDBConnection $db) { |
|
38 | - parent::__construct($db, 'webauthn', PublicKeyCredentialEntity::class); |
|
39 | - } |
|
37 | + public function __construct(IDBConnection $db) { |
|
38 | + parent::__construct($db, 'webauthn', PublicKeyCredentialEntity::class); |
|
39 | + } |
|
40 | 40 | |
41 | - public function findOneByCredentialId(string $publicKeyCredentialId): PublicKeyCredentialEntity { |
|
42 | - $qb = $this->db->getQueryBuilder(); |
|
41 | + public function findOneByCredentialId(string $publicKeyCredentialId): PublicKeyCredentialEntity { |
|
42 | + $qb = $this->db->getQueryBuilder(); |
|
43 | 43 | |
44 | - $qb->select('*') |
|
45 | - ->from($this->getTableName()) |
|
46 | - ->where( |
|
47 | - $qb->expr()->eq('public_key_credential_id', $qb->createNamedParameter(base64_encode($publicKeyCredentialId))) |
|
48 | - ); |
|
44 | + $qb->select('*') |
|
45 | + ->from($this->getTableName()) |
|
46 | + ->where( |
|
47 | + $qb->expr()->eq('public_key_credential_id', $qb->createNamedParameter(base64_encode($publicKeyCredentialId))) |
|
48 | + ); |
|
49 | 49 | |
50 | - return $this->findEntity($qb); |
|
51 | - } |
|
50 | + return $this->findEntity($qb); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return PublicKeyCredentialEntity[] |
|
55 | - */ |
|
56 | - public function findAllForUid(string $uid): array { |
|
57 | - $qb = $this->db->getQueryBuilder(); |
|
53 | + /** |
|
54 | + * @return PublicKeyCredentialEntity[] |
|
55 | + */ |
|
56 | + public function findAllForUid(string $uid): array { |
|
57 | + $qb = $this->db->getQueryBuilder(); |
|
58 | 58 | |
59 | - $qb->select('*') |
|
60 | - ->from($this->getTableName()) |
|
61 | - ->where( |
|
62 | - $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) |
|
63 | - ); |
|
59 | + $qb->select('*') |
|
60 | + ->from($this->getTableName()) |
|
61 | + ->where( |
|
62 | + $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) |
|
63 | + ); |
|
64 | 64 | |
65 | - return $this->findEntities($qb); |
|
66 | - } |
|
65 | + return $this->findEntities($qb); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @param string $uid |
|
70 | - * @param int $id |
|
71 | - * |
|
72 | - * @return PublicKeyCredentialEntity |
|
73 | - * @throws DoesNotExistException |
|
74 | - */ |
|
75 | - public function findById(string $uid, int $id): PublicKeyCredentialEntity { |
|
76 | - $qb = $this->db->getQueryBuilder(); |
|
68 | + /** |
|
69 | + * @param string $uid |
|
70 | + * @param int $id |
|
71 | + * |
|
72 | + * @return PublicKeyCredentialEntity |
|
73 | + * @throws DoesNotExistException |
|
74 | + */ |
|
75 | + public function findById(string $uid, int $id): PublicKeyCredentialEntity { |
|
76 | + $qb = $this->db->getQueryBuilder(); |
|
77 | 77 | |
78 | - $qb->select('*') |
|
79 | - ->from($this->getTableName()) |
|
80 | - ->where($qb->expr()->andX( |
|
81 | - $qb->expr()->eq('id', $qb->createNamedParameter($id)), |
|
82 | - $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) |
|
83 | - )); |
|
78 | + $qb->select('*') |
|
79 | + ->from($this->getTableName()) |
|
80 | + ->where($qb->expr()->andX( |
|
81 | + $qb->expr()->eq('id', $qb->createNamedParameter($id)), |
|
82 | + $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) |
|
83 | + )); |
|
84 | 84 | |
85 | - return $this->findEntity($qb); |
|
86 | - } |
|
85 | + return $this->findEntity($qb); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @throws \OCP\DB\Exception |
|
90 | - */ |
|
91 | - public function deleteByUid(string $uid) { |
|
92 | - $qb = $this->db->getQueryBuilder(); |
|
88 | + /** |
|
89 | + * @throws \OCP\DB\Exception |
|
90 | + */ |
|
91 | + public function deleteByUid(string $uid) { |
|
92 | + $qb = $this->db->getQueryBuilder(); |
|
93 | 93 | |
94 | - $qb->delete($this->getTableName()) |
|
95 | - ->where( |
|
96 | - $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) |
|
97 | - ); |
|
98 | - $qb->executeStatement(); |
|
99 | - } |
|
94 | + $qb->delete($this->getTableName()) |
|
95 | + ->where( |
|
96 | + $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) |
|
97 | + ); |
|
98 | + $qb->executeStatement(); |
|
99 | + } |
|
100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | PropFind $propFind, |
103 | 103 | INode $node): void { |
104 | 104 | if ($node instanceof DeletedCalendarObject) { |
105 | - $propFind->handle(self::PROPERTY_DELETED_AT, function () use ($node) { |
|
105 | + $propFind->handle(self::PROPERTY_DELETED_AT, function() use ($node) { |
|
106 | 106 | $ts = $node->getDeletedAt(); |
107 | 107 | if ($ts === null) { |
108 | 108 | return null; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | ->setTimestamp($ts) |
113 | 113 | ->format(DateTimeInterface::ATOM); |
114 | 114 | }); |
115 | - $propFind->handle(self::PROPERTY_CALENDAR_URI, function () use ($node) { |
|
115 | + $propFind->handle(self::PROPERTY_CALENDAR_URI, function() use ($node) { |
|
116 | 116 | return $node->getCalendarUri(); |
117 | 117 | }); |
118 | 118 | } |
119 | 119 | if ($node instanceof TrashbinHome) { |
120 | - $propFind->handle(self::PROPERTY_RETENTION_DURATION, function () use ($node) { |
|
120 | + $propFind->handle(self::PROPERTY_RETENTION_DURATION, function() use ($node) { |
|
121 | 121 | return $this->retentionService->getDuration(); |
122 | 122 | }); |
123 | 123 | } |
@@ -25,90 +25,90 @@ |
||
25 | 25 | use function implode; |
26 | 26 | |
27 | 27 | class Plugin extends ServerPlugin { |
28 | - public const PROPERTY_DELETED_AT = '{http://nextcloud.com/ns}deleted-at'; |
|
29 | - public const PROPERTY_CALENDAR_URI = '{http://nextcloud.com/ns}calendar-uri'; |
|
30 | - public const PROPERTY_RETENTION_DURATION = '{http://nextcloud.com/ns}trash-bin-retention-duration'; |
|
31 | - |
|
32 | - /** @var bool */ |
|
33 | - private $disableTrashbin; |
|
34 | - |
|
35 | - /** @var Server */ |
|
36 | - private $server; |
|
37 | - |
|
38 | - public function __construct( |
|
39 | - IRequest $request, |
|
40 | - private RetentionService $retentionService, |
|
41 | - ) { |
|
42 | - $this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1'; |
|
43 | - } |
|
44 | - |
|
45 | - public function initialize(Server $server): void { |
|
46 | - $this->server = $server; |
|
47 | - $server->on('beforeMethod:*', [$this, 'beforeMethod']); |
|
48 | - $server->on('propFind', Closure::fromCallable([$this, 'propFind'])); |
|
49 | - } |
|
50 | - |
|
51 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response): void { |
|
52 | - if (!$this->disableTrashbin) { |
|
53 | - return; |
|
54 | - } |
|
55 | - |
|
56 | - $path = $request->getPath(); |
|
57 | - $pathParts = explode('/', ltrim($path, '/')); |
|
58 | - if (\count($pathParts) < 3) { |
|
59 | - // We are looking for a path like calendars/username/calendarname |
|
60 | - return; |
|
61 | - } |
|
62 | - |
|
63 | - // $calendarPath will look like calendars/username/calendarname |
|
64 | - $calendarPath = implode( |
|
65 | - '/', |
|
66 | - array_slice($pathParts, 0, 3) |
|
67 | - ); |
|
68 | - try { |
|
69 | - $calendar = $this->server->tree->getNodeForPath($calendarPath); |
|
70 | - if (!($calendar instanceof Calendar)) { |
|
71 | - // This is odd |
|
72 | - return; |
|
73 | - } |
|
74 | - |
|
75 | - /** @var Calendar $calendar */ |
|
76 | - $calendar->disableTrashbin(); |
|
77 | - } catch (NotFound $ex) { |
|
78 | - return; |
|
79 | - } |
|
80 | - } |
|
81 | - |
|
82 | - private function propFind( |
|
83 | - PropFind $propFind, |
|
84 | - INode $node): void { |
|
85 | - if ($node instanceof DeletedCalendarObject) { |
|
86 | - $propFind->handle(self::PROPERTY_DELETED_AT, function () use ($node) { |
|
87 | - $ts = $node->getDeletedAt(); |
|
88 | - if ($ts === null) { |
|
89 | - return null; |
|
90 | - } |
|
91 | - |
|
92 | - return (new DateTimeImmutable()) |
|
93 | - ->setTimestamp($ts) |
|
94 | - ->format(DateTimeInterface::ATOM); |
|
95 | - }); |
|
96 | - $propFind->handle(self::PROPERTY_CALENDAR_URI, function () use ($node) { |
|
97 | - return $node->getCalendarUri(); |
|
98 | - }); |
|
99 | - } |
|
100 | - if ($node instanceof TrashbinHome) { |
|
101 | - $propFind->handle(self::PROPERTY_RETENTION_DURATION, function () use ($node) { |
|
102 | - return $this->retentionService->getDuration(); |
|
103 | - }); |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - public function getFeatures(): array { |
|
108 | - return ['nc-calendar-trashbin']; |
|
109 | - } |
|
110 | - |
|
111 | - public function getPluginName(): string { |
|
112 | - return 'nc-calendar-trashbin'; |
|
113 | - } |
|
28 | + public const PROPERTY_DELETED_AT = '{http://nextcloud.com/ns}deleted-at'; |
|
29 | + public const PROPERTY_CALENDAR_URI = '{http://nextcloud.com/ns}calendar-uri'; |
|
30 | + public const PROPERTY_RETENTION_DURATION = '{http://nextcloud.com/ns}trash-bin-retention-duration'; |
|
31 | + |
|
32 | + /** @var bool */ |
|
33 | + private $disableTrashbin; |
|
34 | + |
|
35 | + /** @var Server */ |
|
36 | + private $server; |
|
37 | + |
|
38 | + public function __construct( |
|
39 | + IRequest $request, |
|
40 | + private RetentionService $retentionService, |
|
41 | + ) { |
|
42 | + $this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1'; |
|
43 | + } |
|
44 | + |
|
45 | + public function initialize(Server $server): void { |
|
46 | + $this->server = $server; |
|
47 | + $server->on('beforeMethod:*', [$this, 'beforeMethod']); |
|
48 | + $server->on('propFind', Closure::fromCallable([$this, 'propFind'])); |
|
49 | + } |
|
50 | + |
|
51 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response): void { |
|
52 | + if (!$this->disableTrashbin) { |
|
53 | + return; |
|
54 | + } |
|
55 | + |
|
56 | + $path = $request->getPath(); |
|
57 | + $pathParts = explode('/', ltrim($path, '/')); |
|
58 | + if (\count($pathParts) < 3) { |
|
59 | + // We are looking for a path like calendars/username/calendarname |
|
60 | + return; |
|
61 | + } |
|
62 | + |
|
63 | + // $calendarPath will look like calendars/username/calendarname |
|
64 | + $calendarPath = implode( |
|
65 | + '/', |
|
66 | + array_slice($pathParts, 0, 3) |
|
67 | + ); |
|
68 | + try { |
|
69 | + $calendar = $this->server->tree->getNodeForPath($calendarPath); |
|
70 | + if (!($calendar instanceof Calendar)) { |
|
71 | + // This is odd |
|
72 | + return; |
|
73 | + } |
|
74 | + |
|
75 | + /** @var Calendar $calendar */ |
|
76 | + $calendar->disableTrashbin(); |
|
77 | + } catch (NotFound $ex) { |
|
78 | + return; |
|
79 | + } |
|
80 | + } |
|
81 | + |
|
82 | + private function propFind( |
|
83 | + PropFind $propFind, |
|
84 | + INode $node): void { |
|
85 | + if ($node instanceof DeletedCalendarObject) { |
|
86 | + $propFind->handle(self::PROPERTY_DELETED_AT, function () use ($node) { |
|
87 | + $ts = $node->getDeletedAt(); |
|
88 | + if ($ts === null) { |
|
89 | + return null; |
|
90 | + } |
|
91 | + |
|
92 | + return (new DateTimeImmutable()) |
|
93 | + ->setTimestamp($ts) |
|
94 | + ->format(DateTimeInterface::ATOM); |
|
95 | + }); |
|
96 | + $propFind->handle(self::PROPERTY_CALENDAR_URI, function () use ($node) { |
|
97 | + return $node->getCalendarUri(); |
|
98 | + }); |
|
99 | + } |
|
100 | + if ($node instanceof TrashbinHome) { |
|
101 | + $propFind->handle(self::PROPERTY_RETENTION_DURATION, function () use ($node) { |
|
102 | + return $this->retentionService->getDuration(); |
|
103 | + }); |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + public function getFeatures(): array { |
|
108 | + return ['nc-calendar-trashbin']; |
|
109 | + } |
|
110 | + |
|
111 | + public function getPluginName(): string { |
|
112 | + return 'nc-calendar-trashbin'; |
|
113 | + } |
|
114 | 114 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - if (isset($property) && $property->getValue() !== (string)$newValue) { |
|
67 | + if (isset($property) && $property->getValue() !== (string) $newValue) { |
|
68 | 68 | $property->setValue($newValue); |
69 | 69 | $this->accountManager->updateAccount($account); |
70 | 70 | } |
@@ -17,42 +17,42 @@ |
||
17 | 17 | * @template-implements IEventListener<UserChangedEvent> |
18 | 18 | */ |
19 | 19 | class Hooks implements IEventListener { |
20 | - public function __construct( |
|
21 | - private LoggerInterface $logger, |
|
22 | - private IAccountManager $accountManager, |
|
23 | - ) { |
|
24 | - } |
|
20 | + public function __construct( |
|
21 | + private LoggerInterface $logger, |
|
22 | + private IAccountManager $accountManager, |
|
23 | + ) { |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * update accounts table if email address or display name was changed from outside |
|
28 | - */ |
|
29 | - public function changeUserHook(IUser $user, string $feature, $newValue): void { |
|
30 | - $account = $this->accountManager->getAccount($user); |
|
26 | + /** |
|
27 | + * update accounts table if email address or display name was changed from outside |
|
28 | + */ |
|
29 | + public function changeUserHook(IUser $user, string $feature, $newValue): void { |
|
30 | + $account = $this->accountManager->getAccount($user); |
|
31 | 31 | |
32 | - try { |
|
33 | - switch ($feature) { |
|
34 | - case 'eMailAddress': |
|
35 | - $property = $account->getProperty(IAccountManager::PROPERTY_EMAIL); |
|
36 | - break; |
|
37 | - case 'displayName': |
|
38 | - $property = $account->getProperty(IAccountManager::PROPERTY_DISPLAYNAME); |
|
39 | - break; |
|
40 | - } |
|
41 | - } catch (PropertyDoesNotExistException $e) { |
|
42 | - $this->logger->debug($e->getMessage(), ['exception' => $e]); |
|
43 | - return; |
|
44 | - } |
|
32 | + try { |
|
33 | + switch ($feature) { |
|
34 | + case 'eMailAddress': |
|
35 | + $property = $account->getProperty(IAccountManager::PROPERTY_EMAIL); |
|
36 | + break; |
|
37 | + case 'displayName': |
|
38 | + $property = $account->getProperty(IAccountManager::PROPERTY_DISPLAYNAME); |
|
39 | + break; |
|
40 | + } |
|
41 | + } catch (PropertyDoesNotExistException $e) { |
|
42 | + $this->logger->debug($e->getMessage(), ['exception' => $e]); |
|
43 | + return; |
|
44 | + } |
|
45 | 45 | |
46 | - if (isset($property) && $property->getValue() !== (string)$newValue) { |
|
47 | - $property->setValue($newValue); |
|
48 | - $this->accountManager->updateAccount($account); |
|
49 | - } |
|
50 | - } |
|
46 | + if (isset($property) && $property->getValue() !== (string)$newValue) { |
|
47 | + $property->setValue($newValue); |
|
48 | + $this->accountManager->updateAccount($account); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - public function handle(Event $event): void { |
|
53 | - if (!$event instanceof UserChangedEvent) { |
|
54 | - return; |
|
55 | - } |
|
56 | - $this->changeUserHook($event->getUser(), $event->getFeature(), $event->getValue()); |
|
57 | - } |
|
52 | + public function handle(Event $event): void { |
|
53 | + if (!$event instanceof UserChangedEvent) { |
|
54 | + return; |
|
55 | + } |
|
56 | + $this->changeUserHook($event->getUser(), $event->getFeature(), $event->getValue()); |
|
57 | + } |
|
58 | 58 | } |
@@ -29,107 +29,107 @@ |
||
29 | 29 | * @deprecated 23.0.0 |
30 | 30 | */ |
31 | 31 | interface IUser { |
32 | - /** |
|
33 | - * @return string |
|
34 | - * |
|
35 | - * @since 13.0.0 |
|
36 | - * @deprecated 23.0.0 |
|
37 | - */ |
|
38 | - public function getUserId(); |
|
32 | + /** |
|
33 | + * @return string |
|
34 | + * |
|
35 | + * @since 13.0.0 |
|
36 | + * @deprecated 23.0.0 |
|
37 | + */ |
|
38 | + public function getUserId(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - * |
|
43 | - * @since 13.0.0 |
|
44 | - * @deprecated 23.0.0 |
|
45 | - */ |
|
46 | - public function getEmail(); |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + * |
|
43 | + * @since 13.0.0 |
|
44 | + * @deprecated 23.0.0 |
|
45 | + */ |
|
46 | + public function getEmail(); |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string |
|
50 | - * |
|
51 | - * @since 13.0.0 |
|
52 | - * @deprecated 23.0.0 |
|
53 | - */ |
|
54 | - public function getDisplayName(); |
|
48 | + /** |
|
49 | + * @return string |
|
50 | + * |
|
51 | + * @since 13.0.0 |
|
52 | + * @deprecated 23.0.0 |
|
53 | + */ |
|
54 | + public function getDisplayName(); |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return string |
|
58 | - * |
|
59 | - * @since 13.0.0 |
|
60 | - * @deprecated 23.0.0 |
|
61 | - */ |
|
62 | - public function getPhone(); |
|
56 | + /** |
|
57 | + * @return string |
|
58 | + * |
|
59 | + * @since 13.0.0 |
|
60 | + * @deprecated 23.0.0 |
|
61 | + */ |
|
62 | + public function getPhone(); |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return string |
|
66 | - * |
|
67 | - * @since 13.0.0 |
|
68 | - * @deprecated 23.0.0 |
|
69 | - */ |
|
70 | - public function getAddress(); |
|
64 | + /** |
|
65 | + * @return string |
|
66 | + * |
|
67 | + * @since 13.0.0 |
|
68 | + * @deprecated 23.0.0 |
|
69 | + */ |
|
70 | + public function getAddress(); |
|
71 | 71 | |
72 | - /** |
|
73 | - * @return string |
|
74 | - * |
|
75 | - * @since 13.0.0 |
|
76 | - * @deprecated 23.0.0 |
|
77 | - */ |
|
78 | - public function getWebsite(); |
|
72 | + /** |
|
73 | + * @return string |
|
74 | + * |
|
75 | + * @since 13.0.0 |
|
76 | + * @deprecated 23.0.0 |
|
77 | + */ |
|
78 | + public function getWebsite(); |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return string |
|
82 | - * |
|
83 | - * @since 13.0.0 |
|
84 | - * @deprecated 23.0.0 |
|
85 | - */ |
|
86 | - public function getTwitter(); |
|
80 | + /** |
|
81 | + * @return string |
|
82 | + * |
|
83 | + * @since 13.0.0 |
|
84 | + * @deprecated 23.0.0 |
|
85 | + */ |
|
86 | + public function getTwitter(); |
|
87 | 87 | |
88 | - /** |
|
89 | - * @return string[] |
|
90 | - * |
|
91 | - * @since 13.0.0 |
|
92 | - * @deprecated 23.0.0 |
|
93 | - */ |
|
94 | - public function getGroups(); |
|
88 | + /** |
|
89 | + * @return string[] |
|
90 | + * |
|
91 | + * @since 13.0.0 |
|
92 | + * @deprecated 23.0.0 |
|
93 | + */ |
|
94 | + public function getGroups(); |
|
95 | 95 | |
96 | - /** |
|
97 | - * @return string |
|
98 | - * |
|
99 | - * @since 13.0.0 |
|
100 | - * @deprecated 23.0.0 |
|
101 | - */ |
|
102 | - public function getLanguage(); |
|
96 | + /** |
|
97 | + * @return string |
|
98 | + * |
|
99 | + * @since 13.0.0 |
|
100 | + * @deprecated 23.0.0 |
|
101 | + */ |
|
102 | + public function getLanguage(); |
|
103 | 103 | |
104 | - /** |
|
105 | - * @return int |
|
106 | - * |
|
107 | - * @since 13.0.0 |
|
108 | - * @deprecated 23.0.0 |
|
109 | - */ |
|
110 | - public function getUsedSpace(); |
|
104 | + /** |
|
105 | + * @return int |
|
106 | + * |
|
107 | + * @since 13.0.0 |
|
108 | + * @deprecated 23.0.0 |
|
109 | + */ |
|
110 | + public function getUsedSpace(); |
|
111 | 111 | |
112 | - /** |
|
113 | - * @return int |
|
114 | - * |
|
115 | - * @since 13.0.0 |
|
116 | - * @deprecated 23.0.0 |
|
117 | - */ |
|
118 | - public function getFreeSpace(); |
|
112 | + /** |
|
113 | + * @return int |
|
114 | + * |
|
115 | + * @since 13.0.0 |
|
116 | + * @deprecated 23.0.0 |
|
117 | + */ |
|
118 | + public function getFreeSpace(); |
|
119 | 119 | |
120 | - /** |
|
121 | - * @return int |
|
122 | - * |
|
123 | - * @since 13.0.0 |
|
124 | - * @deprecated 23.0.0 |
|
125 | - */ |
|
126 | - public function getTotalSpace(); |
|
120 | + /** |
|
121 | + * @return int |
|
122 | + * |
|
123 | + * @since 13.0.0 |
|
124 | + * @deprecated 23.0.0 |
|
125 | + */ |
|
126 | + public function getTotalSpace(); |
|
127 | 127 | |
128 | - /** |
|
129 | - * @return int |
|
130 | - * |
|
131 | - * @since 13.0.0 |
|
132 | - * @deprecated 23.0.0 |
|
133 | - */ |
|
134 | - public function getQuota(); |
|
128 | + /** |
|
129 | + * @return int |
|
130 | + * |
|
131 | + * @since 13.0.0 |
|
132 | + * @deprecated 23.0.0 |
|
133 | + */ |
|
134 | + public function getQuota(); |
|
135 | 135 | } |
@@ -29,19 +29,19 @@ |
||
29 | 29 | * @deprecated 23.0.0 |
30 | 30 | */ |
31 | 31 | interface ICredentials { |
32 | - /** |
|
33 | - * @return string |
|
34 | - * |
|
35 | - * @since 13.0.0 |
|
36 | - * @deprecated 23.0.0 |
|
37 | - */ |
|
38 | - public function getUsername(); |
|
32 | + /** |
|
33 | + * @return string |
|
34 | + * |
|
35 | + * @since 13.0.0 |
|
36 | + * @deprecated 23.0.0 |
|
37 | + */ |
|
38 | + public function getUsername(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - * |
|
43 | - * @since 13.0.0 |
|
44 | - * @deprecated 23.0.0 |
|
45 | - */ |
|
46 | - public function getPassword(); |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + * |
|
43 | + * @since 13.0.0 |
|
44 | + * @deprecated 23.0.0 |
|
45 | + */ |
|
46 | + public function getPassword(); |
|
47 | 47 | } |
@@ -27,12 +27,12 @@ |
||
27 | 27 | * @deprecated 23.0.0 |
28 | 28 | */ |
29 | 29 | interface IInstanceFactory { |
30 | - /** |
|
31 | - * @param string $url |
|
32 | - * @return IInstance |
|
33 | - * |
|
34 | - * @since 13.0.0 |
|
35 | - * @deprecated 23.0.0 |
|
36 | - */ |
|
37 | - public function getInstance($url); |
|
30 | + /** |
|
31 | + * @param string $url |
|
32 | + * @return IInstance |
|
33 | + * |
|
34 | + * @since 13.0.0 |
|
35 | + * @deprecated 23.0.0 |
|
36 | + */ |
|
37 | + public function getInstance($url); |
|
38 | 38 | } |