@@ -29,32 +29,32 @@ |
||
29 | 29 | |
30 | 30 | class DropAccountTermsTable implements IRepairStep { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - protected $db; |
|
34 | - |
|
35 | - /** |
|
36 | - * @param IDBConnection $db |
|
37 | - */ |
|
38 | - public function __construct(IDBConnection $db) { |
|
39 | - $this->db = $db; |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public function getName() { |
|
46 | - return 'Drop account terms table when migrating from ownCloud'; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @param IOutput $output |
|
51 | - */ |
|
52 | - public function run(IOutput $output) { |
|
53 | - if (!$this->db->tableExists('account_terms')) { |
|
54 | - return; |
|
55 | - } |
|
56 | - |
|
57 | - $this->db->dropTable('account_terms'); |
|
58 | - } |
|
32 | + /** @var IDBConnection */ |
|
33 | + protected $db; |
|
34 | + |
|
35 | + /** |
|
36 | + * @param IDBConnection $db |
|
37 | + */ |
|
38 | + public function __construct(IDBConnection $db) { |
|
39 | + $this->db = $db; |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public function getName() { |
|
46 | + return 'Drop account terms table when migrating from ownCloud'; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @param IOutput $output |
|
51 | + */ |
|
52 | + public function run(IOutput $output) { |
|
53 | + if (!$this->db->tableExists('account_terms')) { |
|
54 | + return; |
|
55 | + } |
|
56 | + |
|
57 | + $this->db->dropTable('account_terms'); |
|
58 | + } |
|
59 | 59 | } |
60 | 60 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | /** |
64 | 64 | * @param IUser $user |
65 | 65 | * @param string|null $filter |
66 | - * @return IEntry[] |
|
66 | + * @return Entry[] |
|
67 | 67 | */ |
68 | 68 | public function getContacts(IUser $user, $filter) { |
69 | 69 | $allContacts = $this->contactsManager->search($filter ?: '', [ |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if ($excludedGroups) { |
118 | 118 | $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
119 | 119 | $decodedExcludeGroups = json_decode($excludedGroups, true); |
120 | - $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : []; |
|
120 | + $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : []; |
|
121 | 121 | |
122 | 122 | if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) { |
123 | 123 | // a group of the current user is excluded -> filter all local users |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | // Prevent enumerating local users |
136 | - if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) { |
|
136 | + if ($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) { |
|
137 | 137 | $filterUser = true; |
138 | 138 | |
139 | 139 | $mailAddresses = $entry->getEMailAddresses(); |
140 | - foreach($mailAddresses as $mailAddress) { |
|
141 | - if($mailAddress === $filter) { |
|
140 | + foreach ($mailAddresses as $mailAddress) { |
|
141 | + if ($mailAddress === $filter) { |
|
142 | 142 | $filterUser = false; |
143 | 143 | break; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { |
|
147 | + if ($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { |
|
148 | 148 | $filterUser = false; |
149 | 149 | } |
150 | 150 | |
151 | - if($filterUser) { |
|
151 | + if ($filterUser) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return IEntry|null |
173 | 173 | */ |
174 | 174 | public function findOne(IUser $user, $shareType, $shareWith) { |
175 | - switch($shareType) { |
|
175 | + switch ($shareType) { |
|
176 | 176 | case 0: |
177 | 177 | case 6: |
178 | 178 | $filter = ['UID']; |
@@ -37,227 +37,227 @@ |
||
37 | 37 | |
38 | 38 | class ContactsStore implements IContactsStore { |
39 | 39 | |
40 | - /** @var IManager */ |
|
41 | - private $contactsManager; |
|
42 | - |
|
43 | - /** @var IConfig */ |
|
44 | - private $config; |
|
45 | - |
|
46 | - /** @var IUserManager */ |
|
47 | - private $userManager; |
|
48 | - |
|
49 | - /** @var IGroupManager */ |
|
50 | - private $groupManager; |
|
51 | - |
|
52 | - /** |
|
53 | - * @param IManager $contactsManager |
|
54 | - * @param IConfig $config |
|
55 | - * @param IUserManager $userManager |
|
56 | - * @param IGroupManager $groupManager |
|
57 | - */ |
|
58 | - public function __construct(IManager $contactsManager, |
|
59 | - IConfig $config, |
|
60 | - IUserManager $userManager, |
|
61 | - IGroupManager $groupManager) { |
|
62 | - $this->contactsManager = $contactsManager; |
|
63 | - $this->config = $config; |
|
64 | - $this->userManager = $userManager; |
|
65 | - $this->groupManager = $groupManager; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @param IUser $user |
|
70 | - * @param string|null $filter |
|
71 | - * @return IEntry[] |
|
72 | - */ |
|
73 | - public function getContacts(IUser $user, $filter) { |
|
74 | - $allContacts = $this->contactsManager->search($filter ?: '', [ |
|
75 | - 'FN', |
|
76 | - 'EMAIL' |
|
77 | - ]); |
|
78 | - |
|
79 | - $entries = array_map(function(array $contact) { |
|
80 | - return $this->contactArrayToEntry($contact); |
|
81 | - }, $allContacts); |
|
82 | - return $this->filterContacts( |
|
83 | - $user, |
|
84 | - $entries, |
|
85 | - $filter |
|
86 | - ); |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * Filters the contacts. Applies 3 filters: |
|
91 | - * 1. filter the current user |
|
92 | - * 2. if the `shareapi_allow_share_dialog_user_enumeration` config option is |
|
93 | - * enabled it will filter all local users |
|
94 | - * 3. if the `shareapi_exclude_groups` config option is enabled and the |
|
95 | - * current user is in an excluded group it will filter all local users. |
|
96 | - * 4. if the `shareapi_only_share_with_group_members` config option is |
|
97 | - * enabled it will filter all users which doens't have a common group |
|
98 | - * with the current user. |
|
99 | - * |
|
100 | - * @param IUser $self |
|
101 | - * @param Entry[] $entries |
|
102 | - * @param string $filter |
|
103 | - * @return Entry[] the filtered contacts |
|
104 | - */ |
|
105 | - private function filterContacts(IUser $self, |
|
106 | - array $entries, |
|
107 | - $filter) { |
|
108 | - $disallowEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') !== 'yes'; |
|
109 | - $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes'; |
|
110 | - |
|
111 | - // whether to filter out local users |
|
112 | - $skipLocal = false; |
|
113 | - // whether to filter out all users which doesn't have the same group as the current user |
|
114 | - $ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; |
|
115 | - |
|
116 | - $selfGroups = $this->groupManager->getUserGroupIds($self); |
|
117 | - |
|
118 | - if ($excludedGroups) { |
|
119 | - $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
|
120 | - $decodedExcludeGroups = json_decode($excludedGroups, true); |
|
121 | - $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : []; |
|
122 | - |
|
123 | - if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) { |
|
124 | - // a group of the current user is excluded -> filter all local users |
|
125 | - $skipLocal = true; |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - $selfUID = $self->getUID(); |
|
130 | - |
|
131 | - return array_values(array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $filter) { |
|
132 | - if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) { |
|
133 | - return false; |
|
134 | - } |
|
135 | - |
|
136 | - // Prevent enumerating local users |
|
137 | - if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) { |
|
138 | - $filterUser = true; |
|
139 | - |
|
140 | - $mailAddresses = $entry->getEMailAddresses(); |
|
141 | - foreach($mailAddresses as $mailAddress) { |
|
142 | - if($mailAddress === $filter) { |
|
143 | - $filterUser = false; |
|
144 | - break; |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { |
|
149 | - $filterUser = false; |
|
150 | - } |
|
151 | - |
|
152 | - if($filterUser) { |
|
153 | - return false; |
|
154 | - } |
|
155 | - } |
|
156 | - |
|
157 | - if ($ownGroupsOnly && $entry->getProperty('isLocalSystemBook') === true) { |
|
158 | - $uid = $this->userManager->get($entry->getProperty('UID')); |
|
159 | - |
|
160 | - if ($uid === NULL) { |
|
161 | - return false; |
|
162 | - } |
|
163 | - |
|
164 | - $contactGroups = $this->groupManager->getUserGroupIds($uid); |
|
165 | - if (count(array_intersect($contactGroups, $selfGroups)) === 0) { |
|
166 | - // no groups in common, so shouldn't see the contact |
|
167 | - return false; |
|
168 | - } |
|
169 | - } |
|
170 | - |
|
171 | - return $entry->getProperty('UID') !== $selfUID; |
|
172 | - })); |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * @param IUser $user |
|
177 | - * @param integer $shareType |
|
178 | - * @param string $shareWith |
|
179 | - * @return IEntry|null |
|
180 | - */ |
|
181 | - public function findOne(IUser $user, $shareType, $shareWith) { |
|
182 | - switch($shareType) { |
|
183 | - case 0: |
|
184 | - case 6: |
|
185 | - $filter = ['UID']; |
|
186 | - break; |
|
187 | - case 4: |
|
188 | - $filter = ['EMAIL']; |
|
189 | - break; |
|
190 | - default: |
|
191 | - return null; |
|
192 | - } |
|
193 | - |
|
194 | - $userId = $user->getUID(); |
|
195 | - $allContacts = $this->contactsManager->search($shareWith, $filter); |
|
196 | - $contacts = array_filter($allContacts, function($contact) use ($userId) { |
|
197 | - return $contact['UID'] !== $userId; |
|
198 | - }); |
|
199 | - $match = null; |
|
200 | - |
|
201 | - foreach ($contacts as $contact) { |
|
202 | - if ($shareType === 4 && isset($contact['EMAIL'])) { |
|
203 | - if (in_array($shareWith, $contact['EMAIL'])) { |
|
204 | - $match = $contact; |
|
205 | - break; |
|
206 | - } |
|
207 | - } |
|
208 | - if ($shareType === 0 || $shareType === 6) { |
|
209 | - $isLocal = $contact['isLocalSystemBook'] ?? false; |
|
210 | - if ($contact['UID'] === $shareWith && $isLocal === true) { |
|
211 | - $match = $contact; |
|
212 | - break; |
|
213 | - } |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - if ($match) { |
|
218 | - $match = $this->filterContacts($user, [$this->contactArrayToEntry($match)], $shareWith); |
|
219 | - if (count($match) === 1) { |
|
220 | - $match = $match[0]; |
|
221 | - } else { |
|
222 | - $match = null; |
|
223 | - } |
|
224 | - |
|
225 | - } |
|
226 | - |
|
227 | - return $match; |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * @param array $contact |
|
232 | - * @return Entry |
|
233 | - */ |
|
234 | - private function contactArrayToEntry(array $contact) { |
|
235 | - $entry = new Entry(); |
|
236 | - |
|
237 | - if (isset($contact['id'])) { |
|
238 | - $entry->setId($contact['id']); |
|
239 | - } |
|
240 | - |
|
241 | - if (isset($contact['FN'])) { |
|
242 | - $entry->setFullName($contact['FN']); |
|
243 | - } |
|
244 | - |
|
245 | - $avatarPrefix = "VALUE=uri:"; |
|
246 | - if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) { |
|
247 | - $entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix))); |
|
248 | - } |
|
249 | - |
|
250 | - if (isset($contact['EMAIL'])) { |
|
251 | - foreach ($contact['EMAIL'] as $email) { |
|
252 | - $entry->addEMailAddress($email); |
|
253 | - } |
|
254 | - } |
|
255 | - |
|
256 | - // Attach all other properties to the entry too because some |
|
257 | - // providers might make use of it. |
|
258 | - $entry->setProperties($contact); |
|
259 | - |
|
260 | - return $entry; |
|
261 | - } |
|
40 | + /** @var IManager */ |
|
41 | + private $contactsManager; |
|
42 | + |
|
43 | + /** @var IConfig */ |
|
44 | + private $config; |
|
45 | + |
|
46 | + /** @var IUserManager */ |
|
47 | + private $userManager; |
|
48 | + |
|
49 | + /** @var IGroupManager */ |
|
50 | + private $groupManager; |
|
51 | + |
|
52 | + /** |
|
53 | + * @param IManager $contactsManager |
|
54 | + * @param IConfig $config |
|
55 | + * @param IUserManager $userManager |
|
56 | + * @param IGroupManager $groupManager |
|
57 | + */ |
|
58 | + public function __construct(IManager $contactsManager, |
|
59 | + IConfig $config, |
|
60 | + IUserManager $userManager, |
|
61 | + IGroupManager $groupManager) { |
|
62 | + $this->contactsManager = $contactsManager; |
|
63 | + $this->config = $config; |
|
64 | + $this->userManager = $userManager; |
|
65 | + $this->groupManager = $groupManager; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @param IUser $user |
|
70 | + * @param string|null $filter |
|
71 | + * @return IEntry[] |
|
72 | + */ |
|
73 | + public function getContacts(IUser $user, $filter) { |
|
74 | + $allContacts = $this->contactsManager->search($filter ?: '', [ |
|
75 | + 'FN', |
|
76 | + 'EMAIL' |
|
77 | + ]); |
|
78 | + |
|
79 | + $entries = array_map(function(array $contact) { |
|
80 | + return $this->contactArrayToEntry($contact); |
|
81 | + }, $allContacts); |
|
82 | + return $this->filterContacts( |
|
83 | + $user, |
|
84 | + $entries, |
|
85 | + $filter |
|
86 | + ); |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * Filters the contacts. Applies 3 filters: |
|
91 | + * 1. filter the current user |
|
92 | + * 2. if the `shareapi_allow_share_dialog_user_enumeration` config option is |
|
93 | + * enabled it will filter all local users |
|
94 | + * 3. if the `shareapi_exclude_groups` config option is enabled and the |
|
95 | + * current user is in an excluded group it will filter all local users. |
|
96 | + * 4. if the `shareapi_only_share_with_group_members` config option is |
|
97 | + * enabled it will filter all users which doens't have a common group |
|
98 | + * with the current user. |
|
99 | + * |
|
100 | + * @param IUser $self |
|
101 | + * @param Entry[] $entries |
|
102 | + * @param string $filter |
|
103 | + * @return Entry[] the filtered contacts |
|
104 | + */ |
|
105 | + private function filterContacts(IUser $self, |
|
106 | + array $entries, |
|
107 | + $filter) { |
|
108 | + $disallowEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') !== 'yes'; |
|
109 | + $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes'; |
|
110 | + |
|
111 | + // whether to filter out local users |
|
112 | + $skipLocal = false; |
|
113 | + // whether to filter out all users which doesn't have the same group as the current user |
|
114 | + $ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; |
|
115 | + |
|
116 | + $selfGroups = $this->groupManager->getUserGroupIds($self); |
|
117 | + |
|
118 | + if ($excludedGroups) { |
|
119 | + $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
|
120 | + $decodedExcludeGroups = json_decode($excludedGroups, true); |
|
121 | + $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : []; |
|
122 | + |
|
123 | + if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) { |
|
124 | + // a group of the current user is excluded -> filter all local users |
|
125 | + $skipLocal = true; |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + $selfUID = $self->getUID(); |
|
130 | + |
|
131 | + return array_values(array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $filter) { |
|
132 | + if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) { |
|
133 | + return false; |
|
134 | + } |
|
135 | + |
|
136 | + // Prevent enumerating local users |
|
137 | + if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) { |
|
138 | + $filterUser = true; |
|
139 | + |
|
140 | + $mailAddresses = $entry->getEMailAddresses(); |
|
141 | + foreach($mailAddresses as $mailAddress) { |
|
142 | + if($mailAddress === $filter) { |
|
143 | + $filterUser = false; |
|
144 | + break; |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { |
|
149 | + $filterUser = false; |
|
150 | + } |
|
151 | + |
|
152 | + if($filterUser) { |
|
153 | + return false; |
|
154 | + } |
|
155 | + } |
|
156 | + |
|
157 | + if ($ownGroupsOnly && $entry->getProperty('isLocalSystemBook') === true) { |
|
158 | + $uid = $this->userManager->get($entry->getProperty('UID')); |
|
159 | + |
|
160 | + if ($uid === NULL) { |
|
161 | + return false; |
|
162 | + } |
|
163 | + |
|
164 | + $contactGroups = $this->groupManager->getUserGroupIds($uid); |
|
165 | + if (count(array_intersect($contactGroups, $selfGroups)) === 0) { |
|
166 | + // no groups in common, so shouldn't see the contact |
|
167 | + return false; |
|
168 | + } |
|
169 | + } |
|
170 | + |
|
171 | + return $entry->getProperty('UID') !== $selfUID; |
|
172 | + })); |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * @param IUser $user |
|
177 | + * @param integer $shareType |
|
178 | + * @param string $shareWith |
|
179 | + * @return IEntry|null |
|
180 | + */ |
|
181 | + public function findOne(IUser $user, $shareType, $shareWith) { |
|
182 | + switch($shareType) { |
|
183 | + case 0: |
|
184 | + case 6: |
|
185 | + $filter = ['UID']; |
|
186 | + break; |
|
187 | + case 4: |
|
188 | + $filter = ['EMAIL']; |
|
189 | + break; |
|
190 | + default: |
|
191 | + return null; |
|
192 | + } |
|
193 | + |
|
194 | + $userId = $user->getUID(); |
|
195 | + $allContacts = $this->contactsManager->search($shareWith, $filter); |
|
196 | + $contacts = array_filter($allContacts, function($contact) use ($userId) { |
|
197 | + return $contact['UID'] !== $userId; |
|
198 | + }); |
|
199 | + $match = null; |
|
200 | + |
|
201 | + foreach ($contacts as $contact) { |
|
202 | + if ($shareType === 4 && isset($contact['EMAIL'])) { |
|
203 | + if (in_array($shareWith, $contact['EMAIL'])) { |
|
204 | + $match = $contact; |
|
205 | + break; |
|
206 | + } |
|
207 | + } |
|
208 | + if ($shareType === 0 || $shareType === 6) { |
|
209 | + $isLocal = $contact['isLocalSystemBook'] ?? false; |
|
210 | + if ($contact['UID'] === $shareWith && $isLocal === true) { |
|
211 | + $match = $contact; |
|
212 | + break; |
|
213 | + } |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + if ($match) { |
|
218 | + $match = $this->filterContacts($user, [$this->contactArrayToEntry($match)], $shareWith); |
|
219 | + if (count($match) === 1) { |
|
220 | + $match = $match[0]; |
|
221 | + } else { |
|
222 | + $match = null; |
|
223 | + } |
|
224 | + |
|
225 | + } |
|
226 | + |
|
227 | + return $match; |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * @param array $contact |
|
232 | + * @return Entry |
|
233 | + */ |
|
234 | + private function contactArrayToEntry(array $contact) { |
|
235 | + $entry = new Entry(); |
|
236 | + |
|
237 | + if (isset($contact['id'])) { |
|
238 | + $entry->setId($contact['id']); |
|
239 | + } |
|
240 | + |
|
241 | + if (isset($contact['FN'])) { |
|
242 | + $entry->setFullName($contact['FN']); |
|
243 | + } |
|
244 | + |
|
245 | + $avatarPrefix = "VALUE=uri:"; |
|
246 | + if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) { |
|
247 | + $entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix))); |
|
248 | + } |
|
249 | + |
|
250 | + if (isset($contact['EMAIL'])) { |
|
251 | + foreach ($contact['EMAIL'] as $email) { |
|
252 | + $entry->addEMailAddress($email); |
|
253 | + } |
|
254 | + } |
|
255 | + |
|
256 | + // Attach all other properties to the entry too because some |
|
257 | + // providers might make use of it. |
|
258 | + $entry->setProperties($contact); |
|
259 | + |
|
260 | + return $entry; |
|
261 | + } |
|
262 | 262 | |
263 | 263 | } |
@@ -29,48 +29,48 @@ |
||
29 | 29 | */ |
30 | 30 | class ExpireSharesJob extends TimedJob { |
31 | 31 | |
32 | - /** |
|
33 | - * sets the correct interval for this timed job |
|
34 | - */ |
|
35 | - public function __construct() { |
|
36 | - // Run once a day |
|
37 | - $this->setInterval(24 * 60 * 60); |
|
38 | - } |
|
32 | + /** |
|
33 | + * sets the correct interval for this timed job |
|
34 | + */ |
|
35 | + public function __construct() { |
|
36 | + // Run once a day |
|
37 | + $this->setInterval(24 * 60 * 60); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Makes the background job do its work |
|
42 | - * |
|
43 | - * @param array $argument unused argument |
|
44 | - */ |
|
45 | - public function run($argument) { |
|
46 | - $connection = \OC::$server->getDatabaseConnection(); |
|
40 | + /** |
|
41 | + * Makes the background job do its work |
|
42 | + * |
|
43 | + * @param array $argument unused argument |
|
44 | + */ |
|
45 | + public function run($argument) { |
|
46 | + $connection = \OC::$server->getDatabaseConnection(); |
|
47 | 47 | |
48 | - //Current time |
|
49 | - $now = new \DateTime(); |
|
50 | - $now = $now->format('Y-m-d H:i:s'); |
|
48 | + //Current time |
|
49 | + $now = new \DateTime(); |
|
50 | + $now = $now->format('Y-m-d H:i:s'); |
|
51 | 51 | |
52 | - /* |
|
52 | + /* |
|
53 | 53 | * Expire file link shares only (for now) |
54 | 54 | */ |
55 | - $qb = $connection->getQueryBuilder(); |
|
56 | - $qb->select('id', 'file_source', 'uid_owner', 'item_type') |
|
57 | - ->from('share') |
|
58 | - ->where( |
|
59 | - $qb->expr()->andX( |
|
60 | - $qb->expr()->eq('share_type', $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK)), |
|
61 | - $qb->expr()->lte('expiration', $qb->expr()->literal($now)), |
|
62 | - $qb->expr()->orX( |
|
63 | - $qb->expr()->eq('item_type', $qb->expr()->literal('file')), |
|
64 | - $qb->expr()->eq('item_type', $qb->expr()->literal('folder')) |
|
65 | - ) |
|
66 | - ) |
|
67 | - ); |
|
55 | + $qb = $connection->getQueryBuilder(); |
|
56 | + $qb->select('id', 'file_source', 'uid_owner', 'item_type') |
|
57 | + ->from('share') |
|
58 | + ->where( |
|
59 | + $qb->expr()->andX( |
|
60 | + $qb->expr()->eq('share_type', $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK)), |
|
61 | + $qb->expr()->lte('expiration', $qb->expr()->literal($now)), |
|
62 | + $qb->expr()->orX( |
|
63 | + $qb->expr()->eq('item_type', $qb->expr()->literal('file')), |
|
64 | + $qb->expr()->eq('item_type', $qb->expr()->literal('folder')) |
|
65 | + ) |
|
66 | + ) |
|
67 | + ); |
|
68 | 68 | |
69 | - $shares = $qb->execute(); |
|
70 | - while($share = $shares->fetch()) { |
|
71 | - \OC\Share\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']); |
|
72 | - } |
|
73 | - $shares->closeCursor(); |
|
74 | - } |
|
69 | + $shares = $qb->execute(); |
|
70 | + while($share = $shares->fetch()) { |
|
71 | + \OC\Share\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']); |
|
72 | + } |
|
73 | + $shares->closeCursor(); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | $shares = $qb->execute(); |
70 | - while($share = $shares->fetch()) { |
|
70 | + while ($share = $shares->fetch()) { |
|
71 | 71 | \OC\Share\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']); |
72 | 72 | } |
73 | 73 | $shares->closeCursor(); |
@@ -27,18 +27,18 @@ |
||
27 | 27 | */ |
28 | 28 | class InvalidAuth extends AuthMechanism { |
29 | 29 | |
30 | - /** |
|
31 | - * Constructs a new InvalidAuth with the id of the invalid auth |
|
32 | - * for display purposes |
|
33 | - * |
|
34 | - * @param string $invalidId invalid id |
|
35 | - */ |
|
36 | - public function __construct($invalidId) { |
|
37 | - $this |
|
38 | - ->setIdentifier($invalidId) |
|
39 | - ->setScheme(self::SCHEME_NULL) |
|
40 | - ->setText('Unknown auth mechanism backend ' . $invalidId) |
|
41 | - ; |
|
42 | - } |
|
30 | + /** |
|
31 | + * Constructs a new InvalidAuth with the id of the invalid auth |
|
32 | + * for display purposes |
|
33 | + * |
|
34 | + * @param string $invalidId invalid id |
|
35 | + */ |
|
36 | + public function __construct($invalidId) { |
|
37 | + $this |
|
38 | + ->setIdentifier($invalidId) |
|
39 | + ->setScheme(self::SCHEME_NULL) |
|
40 | + ->setText('Unknown auth mechanism backend ' . $invalidId) |
|
41 | + ; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $this |
38 | 38 | ->setIdentifier($invalidId) |
39 | 39 | ->setScheme(self::SCHEME_NULL) |
40 | - ->setText('Unknown auth mechanism backend ' . $invalidId) |
|
40 | + ->setText('Unknown auth mechanism backend '.$invalidId) |
|
41 | 41 | ; |
42 | 42 | } |
43 | 43 |
@@ -29,192 +29,192 @@ |
||
29 | 29 | |
30 | 30 | interface ILDAPWrapper { |
31 | 31 | |
32 | - //LDAP functions in use |
|
33 | - |
|
34 | - /** |
|
35 | - * Bind to LDAP directory |
|
36 | - * @param resource $link LDAP link resource |
|
37 | - * @param string $dn an RDN to log in with |
|
38 | - * @param string $password the password |
|
39 | - * @return bool true on success, false otherwise |
|
40 | - * |
|
41 | - * with $dn and $password as null a anonymous bind is attempted. |
|
42 | - */ |
|
43 | - public function bind($link, $dn, $password); |
|
44 | - |
|
45 | - /** |
|
46 | - * connect to an LDAP server |
|
47 | - * @param string $host The host to connect to |
|
48 | - * @param string $port The port to connect to |
|
49 | - * @return mixed a link resource on success, otherwise false |
|
50 | - */ |
|
51 | - public function connect($host, $port); |
|
52 | - |
|
53 | - /** |
|
54 | - * Send LDAP pagination control |
|
55 | - * @param resource $link LDAP link resource |
|
56 | - * @param int $pageSize number of results per page |
|
57 | - * @param bool $isCritical Indicates whether the pagination is critical of not. |
|
58 | - * @param string $cookie structure sent by LDAP server |
|
59 | - * @return bool true on success, false otherwise |
|
60 | - */ |
|
61 | - public function controlPagedResult($link, $pageSize, $isCritical, $cookie); |
|
62 | - |
|
63 | - /** |
|
64 | - * Retrieve the LDAP pagination cookie |
|
65 | - * @param resource $link LDAP link resource |
|
66 | - * @param resource $result LDAP result resource |
|
67 | - * @param string $cookie structure sent by LDAP server |
|
68 | - * @return bool true on success, false otherwise |
|
69 | - * |
|
70 | - * Corresponds to ldap_control_paged_result_response |
|
71 | - */ |
|
72 | - public function controlPagedResultResponse($link, $result, &$cookie); |
|
73 | - |
|
74 | - /** |
|
75 | - * Count the number of entries in a search |
|
76 | - * @param resource $link LDAP link resource |
|
77 | - * @param resource $result LDAP result resource |
|
78 | - * @return int|false number of results on success, false otherwise |
|
79 | - */ |
|
80 | - public function countEntries($link, $result); |
|
81 | - |
|
82 | - /** |
|
83 | - * Return the LDAP error number of the last LDAP command |
|
84 | - * @param resource $link LDAP link resource |
|
85 | - * @return int error code |
|
86 | - */ |
|
87 | - public function errno($link); |
|
88 | - |
|
89 | - /** |
|
90 | - * Return the LDAP error message of the last LDAP command |
|
91 | - * @param resource $link LDAP link resource |
|
92 | - * @return string error message |
|
93 | - */ |
|
94 | - public function error($link); |
|
95 | - |
|
96 | - /** |
|
97 | - * Splits DN into its component parts |
|
98 | - * @param string $dn |
|
99 | - * @param int @withAttrib |
|
100 | - * @return array|false |
|
101 | - * @link http://www.php.net/manual/en/function.ldap-explode-dn.php |
|
102 | - */ |
|
103 | - public function explodeDN($dn, $withAttrib); |
|
104 | - |
|
105 | - /** |
|
106 | - * Return first result id |
|
107 | - * @param resource $link LDAP link resource |
|
108 | - * @param resource $result LDAP result resource |
|
109 | - * @return Resource an LDAP search result resource |
|
110 | - * */ |
|
111 | - public function firstEntry($link, $result); |
|
112 | - |
|
113 | - /** |
|
114 | - * Get attributes from a search result entry |
|
115 | - * @param resource $link LDAP link resource |
|
116 | - * @param resource $result LDAP result resource |
|
117 | - * @return array containing the results, false on error |
|
118 | - * */ |
|
119 | - public function getAttributes($link, $result); |
|
120 | - |
|
121 | - /** |
|
122 | - * Get the DN of a result entry |
|
123 | - * @param resource $link LDAP link resource |
|
124 | - * @param resource $result LDAP result resource |
|
125 | - * @return string containing the DN, false on error |
|
126 | - */ |
|
127 | - public function getDN($link, $result); |
|
128 | - |
|
129 | - /** |
|
130 | - * Get all result entries |
|
131 | - * @param resource $link LDAP link resource |
|
132 | - * @param resource $result LDAP result resource |
|
133 | - * @return array containing the results, false on error |
|
134 | - */ |
|
135 | - public function getEntries($link, $result); |
|
136 | - |
|
137 | - /** |
|
138 | - * Return next result id |
|
139 | - * @param resource $link LDAP link resource |
|
140 | - * @param resource $result LDAP entry result resource |
|
141 | - * @return resource an LDAP search result resource |
|
142 | - * */ |
|
143 | - public function nextEntry($link, $result); |
|
144 | - |
|
145 | - /** |
|
146 | - * Read an entry |
|
147 | - * @param resource $link LDAP link resource |
|
148 | - * @param array $baseDN The DN of the entry to read from |
|
149 | - * @param string $filter An LDAP filter |
|
150 | - * @param array $attr array of the attributes to read |
|
151 | - * @return resource an LDAP search result resource |
|
152 | - */ |
|
153 | - public function read($link, $baseDN, $filter, $attr); |
|
154 | - |
|
155 | - /** |
|
156 | - * Search LDAP tree |
|
157 | - * @param resource $link LDAP link resource |
|
158 | - * @param string $baseDN The DN of the entry to read from |
|
159 | - * @param string $filter An LDAP filter |
|
160 | - * @param array $attr array of the attributes to read |
|
161 | - * @param int $attrsOnly optional, 1 if only attribute types shall be returned |
|
162 | - * @param int $limit optional, limits the result entries |
|
163 | - * @return resource|false an LDAP search result resource, false on error |
|
164 | - */ |
|
165 | - public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); |
|
166 | - |
|
167 | - /** |
|
168 | - * Replace the value of a userPassword by $password |
|
169 | - * @param resource $link LDAP link resource |
|
170 | - * @param string $userDN the DN of the user whose password is to be replaced |
|
171 | - * @param string $password the new value for the userPassword |
|
172 | - * @return bool true on success, false otherwise |
|
173 | - */ |
|
174 | - public function modReplace($link, $userDN, $password); |
|
175 | - |
|
176 | - /** |
|
177 | - * Sets the value of the specified option to be $value |
|
178 | - * @param resource $link LDAP link resource |
|
179 | - * @param string $option a defined LDAP Server option |
|
180 | - * @param int $value the new value for the option |
|
181 | - * @return bool true on success, false otherwise |
|
182 | - */ |
|
183 | - public function setOption($link, $option, $value); |
|
184 | - |
|
185 | - /** |
|
186 | - * establish Start TLS |
|
187 | - * @param resource $link LDAP link resource |
|
188 | - * @return bool true on success, false otherwise |
|
189 | - */ |
|
190 | - public function startTls($link); |
|
191 | - |
|
192 | - /** |
|
193 | - * Unbind from LDAP directory |
|
194 | - * @param resource $link LDAP link resource |
|
195 | - * @return bool true on success, false otherwise |
|
196 | - */ |
|
197 | - public function unbind($link); |
|
198 | - |
|
199 | - //additional required methods in Nextcloud |
|
200 | - |
|
201 | - /** |
|
202 | - * Checks whether the server supports LDAP |
|
203 | - * @return bool true if it the case, false otherwise |
|
204 | - * */ |
|
205 | - public function areLDAPFunctionsAvailable(); |
|
206 | - |
|
207 | - /** |
|
208 | - * Checks whether PHP supports LDAP Paged Results |
|
209 | - * @return bool true if it the case, false otherwise |
|
210 | - * */ |
|
211 | - public function hasPagedResultSupport(); |
|
212 | - |
|
213 | - /** |
|
214 | - * Checks whether the submitted parameter is a resource |
|
215 | - * @param resource $resource the resource variable to check |
|
216 | - * @return bool true if it is a resource, false otherwise |
|
217 | - */ |
|
218 | - public function isResource($resource); |
|
32 | + //LDAP functions in use |
|
33 | + |
|
34 | + /** |
|
35 | + * Bind to LDAP directory |
|
36 | + * @param resource $link LDAP link resource |
|
37 | + * @param string $dn an RDN to log in with |
|
38 | + * @param string $password the password |
|
39 | + * @return bool true on success, false otherwise |
|
40 | + * |
|
41 | + * with $dn and $password as null a anonymous bind is attempted. |
|
42 | + */ |
|
43 | + public function bind($link, $dn, $password); |
|
44 | + |
|
45 | + /** |
|
46 | + * connect to an LDAP server |
|
47 | + * @param string $host The host to connect to |
|
48 | + * @param string $port The port to connect to |
|
49 | + * @return mixed a link resource on success, otherwise false |
|
50 | + */ |
|
51 | + public function connect($host, $port); |
|
52 | + |
|
53 | + /** |
|
54 | + * Send LDAP pagination control |
|
55 | + * @param resource $link LDAP link resource |
|
56 | + * @param int $pageSize number of results per page |
|
57 | + * @param bool $isCritical Indicates whether the pagination is critical of not. |
|
58 | + * @param string $cookie structure sent by LDAP server |
|
59 | + * @return bool true on success, false otherwise |
|
60 | + */ |
|
61 | + public function controlPagedResult($link, $pageSize, $isCritical, $cookie); |
|
62 | + |
|
63 | + /** |
|
64 | + * Retrieve the LDAP pagination cookie |
|
65 | + * @param resource $link LDAP link resource |
|
66 | + * @param resource $result LDAP result resource |
|
67 | + * @param string $cookie structure sent by LDAP server |
|
68 | + * @return bool true on success, false otherwise |
|
69 | + * |
|
70 | + * Corresponds to ldap_control_paged_result_response |
|
71 | + */ |
|
72 | + public function controlPagedResultResponse($link, $result, &$cookie); |
|
73 | + |
|
74 | + /** |
|
75 | + * Count the number of entries in a search |
|
76 | + * @param resource $link LDAP link resource |
|
77 | + * @param resource $result LDAP result resource |
|
78 | + * @return int|false number of results on success, false otherwise |
|
79 | + */ |
|
80 | + public function countEntries($link, $result); |
|
81 | + |
|
82 | + /** |
|
83 | + * Return the LDAP error number of the last LDAP command |
|
84 | + * @param resource $link LDAP link resource |
|
85 | + * @return int error code |
|
86 | + */ |
|
87 | + public function errno($link); |
|
88 | + |
|
89 | + /** |
|
90 | + * Return the LDAP error message of the last LDAP command |
|
91 | + * @param resource $link LDAP link resource |
|
92 | + * @return string error message |
|
93 | + */ |
|
94 | + public function error($link); |
|
95 | + |
|
96 | + /** |
|
97 | + * Splits DN into its component parts |
|
98 | + * @param string $dn |
|
99 | + * @param int @withAttrib |
|
100 | + * @return array|false |
|
101 | + * @link http://www.php.net/manual/en/function.ldap-explode-dn.php |
|
102 | + */ |
|
103 | + public function explodeDN($dn, $withAttrib); |
|
104 | + |
|
105 | + /** |
|
106 | + * Return first result id |
|
107 | + * @param resource $link LDAP link resource |
|
108 | + * @param resource $result LDAP result resource |
|
109 | + * @return Resource an LDAP search result resource |
|
110 | + * */ |
|
111 | + public function firstEntry($link, $result); |
|
112 | + |
|
113 | + /** |
|
114 | + * Get attributes from a search result entry |
|
115 | + * @param resource $link LDAP link resource |
|
116 | + * @param resource $result LDAP result resource |
|
117 | + * @return array containing the results, false on error |
|
118 | + * */ |
|
119 | + public function getAttributes($link, $result); |
|
120 | + |
|
121 | + /** |
|
122 | + * Get the DN of a result entry |
|
123 | + * @param resource $link LDAP link resource |
|
124 | + * @param resource $result LDAP result resource |
|
125 | + * @return string containing the DN, false on error |
|
126 | + */ |
|
127 | + public function getDN($link, $result); |
|
128 | + |
|
129 | + /** |
|
130 | + * Get all result entries |
|
131 | + * @param resource $link LDAP link resource |
|
132 | + * @param resource $result LDAP result resource |
|
133 | + * @return array containing the results, false on error |
|
134 | + */ |
|
135 | + public function getEntries($link, $result); |
|
136 | + |
|
137 | + /** |
|
138 | + * Return next result id |
|
139 | + * @param resource $link LDAP link resource |
|
140 | + * @param resource $result LDAP entry result resource |
|
141 | + * @return resource an LDAP search result resource |
|
142 | + * */ |
|
143 | + public function nextEntry($link, $result); |
|
144 | + |
|
145 | + /** |
|
146 | + * Read an entry |
|
147 | + * @param resource $link LDAP link resource |
|
148 | + * @param array $baseDN The DN of the entry to read from |
|
149 | + * @param string $filter An LDAP filter |
|
150 | + * @param array $attr array of the attributes to read |
|
151 | + * @return resource an LDAP search result resource |
|
152 | + */ |
|
153 | + public function read($link, $baseDN, $filter, $attr); |
|
154 | + |
|
155 | + /** |
|
156 | + * Search LDAP tree |
|
157 | + * @param resource $link LDAP link resource |
|
158 | + * @param string $baseDN The DN of the entry to read from |
|
159 | + * @param string $filter An LDAP filter |
|
160 | + * @param array $attr array of the attributes to read |
|
161 | + * @param int $attrsOnly optional, 1 if only attribute types shall be returned |
|
162 | + * @param int $limit optional, limits the result entries |
|
163 | + * @return resource|false an LDAP search result resource, false on error |
|
164 | + */ |
|
165 | + public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); |
|
166 | + |
|
167 | + /** |
|
168 | + * Replace the value of a userPassword by $password |
|
169 | + * @param resource $link LDAP link resource |
|
170 | + * @param string $userDN the DN of the user whose password is to be replaced |
|
171 | + * @param string $password the new value for the userPassword |
|
172 | + * @return bool true on success, false otherwise |
|
173 | + */ |
|
174 | + public function modReplace($link, $userDN, $password); |
|
175 | + |
|
176 | + /** |
|
177 | + * Sets the value of the specified option to be $value |
|
178 | + * @param resource $link LDAP link resource |
|
179 | + * @param string $option a defined LDAP Server option |
|
180 | + * @param int $value the new value for the option |
|
181 | + * @return bool true on success, false otherwise |
|
182 | + */ |
|
183 | + public function setOption($link, $option, $value); |
|
184 | + |
|
185 | + /** |
|
186 | + * establish Start TLS |
|
187 | + * @param resource $link LDAP link resource |
|
188 | + * @return bool true on success, false otherwise |
|
189 | + */ |
|
190 | + public function startTls($link); |
|
191 | + |
|
192 | + /** |
|
193 | + * Unbind from LDAP directory |
|
194 | + * @param resource $link LDAP link resource |
|
195 | + * @return bool true on success, false otherwise |
|
196 | + */ |
|
197 | + public function unbind($link); |
|
198 | + |
|
199 | + //additional required methods in Nextcloud |
|
200 | + |
|
201 | + /** |
|
202 | + * Checks whether the server supports LDAP |
|
203 | + * @return bool true if it the case, false otherwise |
|
204 | + * */ |
|
205 | + public function areLDAPFunctionsAvailable(); |
|
206 | + |
|
207 | + /** |
|
208 | + * Checks whether PHP supports LDAP Paged Results |
|
209 | + * @return bool true if it the case, false otherwise |
|
210 | + * */ |
|
211 | + public function hasPagedResultSupport(); |
|
212 | + |
|
213 | + /** |
|
214 | + * Checks whether the submitted parameter is a resource |
|
215 | + * @param resource $resource the resource variable to check |
|
216 | + * @return bool true if it is a resource, false otherwise |
|
217 | + */ |
|
218 | + public function isResource($resource); |
|
219 | 219 | |
220 | 220 | } |
@@ -26,20 +26,20 @@ |
||
26 | 26 | |
27 | 27 | interface IGroupLDAP { |
28 | 28 | |
29 | - //Used by LDAPProvider |
|
29 | + //Used by LDAPProvider |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return access for LDAP interaction. |
|
33 | - * @param string $gid |
|
34 | - * @return Access instance of Access for LDAP interaction |
|
35 | - */ |
|
36 | - public function getLDAPAccess($gid); |
|
31 | + /** |
|
32 | + * Return access for LDAP interaction. |
|
33 | + * @param string $gid |
|
34 | + * @return Access instance of Access for LDAP interaction |
|
35 | + */ |
|
36 | + public function getLDAPAccess($gid); |
|
37 | 37 | |
38 | - /** |
|
39 | - * Return a new LDAP connection for the specified group. |
|
40 | - * @param string $gid |
|
41 | - * @return resource of the LDAP connection |
|
42 | - */ |
|
43 | - public function getNewLDAPConnection($gid); |
|
38 | + /** |
|
39 | + * Return a new LDAP connection for the specified group. |
|
40 | + * @param string $gid |
|
41 | + * @return resource of the LDAP connection |
|
42 | + */ |
|
43 | + public function getNewLDAPConnection($gid); |
|
44 | 44 | |
45 | 45 | } |
@@ -38,27 +38,27 @@ |
||
38 | 38 | */ |
39 | 39 | interface IApacheBackend { |
40 | 40 | |
41 | - /** |
|
42 | - * In case the user has been authenticated by a module true is returned. |
|
43 | - * |
|
44 | - * @return boolean whether the module reports a user as currently logged in. |
|
45 | - * @since 6.0.0 |
|
46 | - */ |
|
47 | - public function isSessionActive(); |
|
41 | + /** |
|
42 | + * In case the user has been authenticated by a module true is returned. |
|
43 | + * |
|
44 | + * @return boolean whether the module reports a user as currently logged in. |
|
45 | + * @since 6.0.0 |
|
46 | + */ |
|
47 | + public function isSessionActive(); |
|
48 | 48 | |
49 | - /** |
|
50 | - * Gets the current logout URL |
|
51 | - * |
|
52 | - * @return string |
|
53 | - * @since 12.0.3 |
|
54 | - */ |
|
55 | - public function getLogoutUrl(); |
|
49 | + /** |
|
50 | + * Gets the current logout URL |
|
51 | + * |
|
52 | + * @return string |
|
53 | + * @since 12.0.3 |
|
54 | + */ |
|
55 | + public function getLogoutUrl(); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Return the id of the current user |
|
59 | - * @return string |
|
60 | - * @since 6.0.0 |
|
61 | - */ |
|
62 | - public function getCurrentUserId(); |
|
57 | + /** |
|
58 | + * Return the id of the current user |
|
59 | + * @return string |
|
60 | + * @since 6.0.0 |
|
61 | + */ |
|
62 | + public function getCurrentUserId(); |
|
63 | 63 | |
64 | 64 | } |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | <li> |
8 | 8 | <a class="button two-factor-provider" |
9 | 9 | href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', |
10 | - [ |
|
11 | - 'challengeProviderId' => $provider->getId(), |
|
12 | - 'redirect_url' => $_['redirect_url'], |
|
13 | - ] |
|
14 | - )) ?>"> |
|
10 | + [ |
|
11 | + 'challengeProviderId' => $provider->getId(), |
|
12 | + 'redirect_url' => $_['redirect_url'], |
|
13 | + ] |
|
14 | + )) ?>"> |
|
15 | 15 | <?php p($provider->getDescription()) ?> |
16 | 16 | </a> |
17 | 17 | </li> |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | <a class="button" href="<?php print_unescaped($_['logout_url']); ?>"><?php p($l->t('Cancel log in')) ?></a> |
23 | 23 | <?php if (!is_null($_['backupProvider'])): ?> |
24 | 24 | <a class="button" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', |
25 | - [ |
|
26 | - 'challengeProviderId' => $_['backupProvider']->getId(), |
|
27 | - 'redirect_url' => $_['redirect_url'], |
|
28 | - ] |
|
29 | - )) ?>"><?php p($l->t('Use backup code')) ?></a> |
|
25 | + [ |
|
26 | + 'challengeProviderId' => $_['backupProvider']->getId(), |
|
27 | + 'redirect_url' => $_['redirect_url'], |
|
28 | + ] |
|
29 | + )) ?>"><?php p($l->t('Use backup code')) ?></a> |
|
30 | 30 | <?php endif; ?> |
31 | 31 | </p> |
32 | 32 | </div> |
@@ -31,89 +31,89 @@ |
||
31 | 31 | * @since 9.0.0 |
32 | 32 | */ |
33 | 33 | interface IUserMountCache { |
34 | - /** |
|
35 | - * Register mounts for a user to the cache |
|
36 | - * |
|
37 | - * @param IUser $user |
|
38 | - * @param IMountPoint[] $mounts |
|
39 | - * @since 9.0.0 |
|
40 | - */ |
|
41 | - public function registerMounts(IUser $user, array $mounts); |
|
34 | + /** |
|
35 | + * Register mounts for a user to the cache |
|
36 | + * |
|
37 | + * @param IUser $user |
|
38 | + * @param IMountPoint[] $mounts |
|
39 | + * @since 9.0.0 |
|
40 | + */ |
|
41 | + public function registerMounts(IUser $user, array $mounts); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get all cached mounts for a user |
|
45 | - * |
|
46 | - * @param IUser $user |
|
47 | - * @return ICachedMountInfo[] |
|
48 | - * @since 9.0.0 |
|
49 | - */ |
|
50 | - public function getMountsForUser(IUser $user); |
|
43 | + /** |
|
44 | + * Get all cached mounts for a user |
|
45 | + * |
|
46 | + * @param IUser $user |
|
47 | + * @return ICachedMountInfo[] |
|
48 | + * @since 9.0.0 |
|
49 | + */ |
|
50 | + public function getMountsForUser(IUser $user); |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get all cached mounts by storage |
|
54 | - * |
|
55 | - * @param int $numericStorageId |
|
56 | - * @param string|null $user limit the results to a single user @since 12.0.0 |
|
57 | - * @return ICachedMountInfo[] |
|
58 | - * @since 9.0.0 |
|
59 | - */ |
|
60 | - public function getMountsForStorageId($numericStorageId, $user = null); |
|
52 | + /** |
|
53 | + * Get all cached mounts by storage |
|
54 | + * |
|
55 | + * @param int $numericStorageId |
|
56 | + * @param string|null $user limit the results to a single user @since 12.0.0 |
|
57 | + * @return ICachedMountInfo[] |
|
58 | + * @since 9.0.0 |
|
59 | + */ |
|
60 | + public function getMountsForStorageId($numericStorageId, $user = null); |
|
61 | 61 | |
62 | - /** |
|
63 | - * Get all cached mounts by root |
|
64 | - * |
|
65 | - * @param int $rootFileId |
|
66 | - * @return ICachedMountInfo[] |
|
67 | - * @since 9.0.0 |
|
68 | - */ |
|
69 | - public function getMountsForRootId($rootFileId); |
|
62 | + /** |
|
63 | + * Get all cached mounts by root |
|
64 | + * |
|
65 | + * @param int $rootFileId |
|
66 | + * @return ICachedMountInfo[] |
|
67 | + * @since 9.0.0 |
|
68 | + */ |
|
69 | + public function getMountsForRootId($rootFileId); |
|
70 | 70 | |
71 | - /** |
|
72 | - * Get all cached mounts that contain a file |
|
73 | - * |
|
74 | - * @param int $fileId |
|
75 | - * @param string|null $user optionally restrict the results to a single user @since 12.0.0 |
|
76 | - * @return ICachedMountFileInfo[] |
|
77 | - * @since 9.0.0 |
|
78 | - */ |
|
79 | - public function getMountsForFileId($fileId, $user = null); |
|
71 | + /** |
|
72 | + * Get all cached mounts that contain a file |
|
73 | + * |
|
74 | + * @param int $fileId |
|
75 | + * @param string|null $user optionally restrict the results to a single user @since 12.0.0 |
|
76 | + * @return ICachedMountFileInfo[] |
|
77 | + * @since 9.0.0 |
|
78 | + */ |
|
79 | + public function getMountsForFileId($fileId, $user = null); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Remove all cached mounts for a user |
|
83 | - * |
|
84 | - * @param IUser $user |
|
85 | - * @since 9.0.0 |
|
86 | - */ |
|
87 | - public function removeUserMounts(IUser $user); |
|
81 | + /** |
|
82 | + * Remove all cached mounts for a user |
|
83 | + * |
|
84 | + * @param IUser $user |
|
85 | + * @since 9.0.0 |
|
86 | + */ |
|
87 | + public function removeUserMounts(IUser $user); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Remove all mounts for a user and storage |
|
91 | - * |
|
92 | - * @param $storageId |
|
93 | - * @param string $userId |
|
94 | - * @return mixed |
|
95 | - * @since 9.0.0 |
|
96 | - */ |
|
97 | - public function removeUserStorageMount($storageId, $userId); |
|
89 | + /** |
|
90 | + * Remove all mounts for a user and storage |
|
91 | + * |
|
92 | + * @param $storageId |
|
93 | + * @param string $userId |
|
94 | + * @return mixed |
|
95 | + * @since 9.0.0 |
|
96 | + */ |
|
97 | + public function removeUserStorageMount($storageId, $userId); |
|
98 | 98 | |
99 | - /** |
|
100 | - * Remove all cached mounts for a storage |
|
101 | - * |
|
102 | - * @param $storageId |
|
103 | - * @return mixed |
|
104 | - * @since 9.0.0 |
|
105 | - */ |
|
106 | - public function remoteStorageMounts($storageId); |
|
99 | + /** |
|
100 | + * Remove all cached mounts for a storage |
|
101 | + * |
|
102 | + * @param $storageId |
|
103 | + * @return mixed |
|
104 | + * @since 9.0.0 |
|
105 | + */ |
|
106 | + public function remoteStorageMounts($storageId); |
|
107 | 107 | |
108 | - /** |
|
109 | - * Get the used space for users |
|
110 | - * |
|
111 | - * Note that this only includes the space in their home directory, |
|
112 | - * not any incoming shares or external storages. |
|
113 | - * |
|
114 | - * @param IUser[] $users |
|
115 | - * @return int[] [$userId => $userSpace] |
|
116 | - * @since 13.0.0 |
|
117 | - */ |
|
118 | - public function getUsedSpaceForUsers(array $users); |
|
108 | + /** |
|
109 | + * Get the used space for users |
|
110 | + * |
|
111 | + * Note that this only includes the space in their home directory, |
|
112 | + * not any incoming shares or external storages. |
|
113 | + * |
|
114 | + * @param IUser[] $users |
|
115 | + * @return int[] [$userId => $userSpace] |
|
116 | + * @since 13.0.0 |
|
117 | + */ |
|
118 | + public function getUsedSpaceForUsers(array $users); |
|
119 | 119 | } |