|
9 | 9 |
|
10 | 10 | use OC\KnownUser\KnownUserService; |
11 | 11 | use OC\Profile\ProfileManager; |
| 12 | +use OC\Share20\ShareDisableChecker; |
12 | 13 | use OCA\UserStatus\Db\UserStatus; |
13 | 14 | use OCA\UserStatus\Service\StatusService; |
14 | 15 | use OCP\Contacts\ContactsMenu\IContactsStore; |
@@ -38,6 +39,7 @@ public function __construct( |
38 | 39 | private IGroupManager $groupManager, |
39 | 40 | private KnownUserService $knownUserService, |
40 | 41 | private IL10NFactory $l10nFactory, |
| 42 | + private ShareDisableChecker $shareDisableChecker, |
41 | 43 | ) { |
42 | 44 | } |
43 | 45 |
|
@@ -173,31 +175,11 @@ private function filterContacts( |
173 | 175 | $excludeGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no'); |
174 | 176 |
|
175 | 177 | // whether to filter out local users |
176 | | - $skipLocal = false; |
| 178 | + $skipLocal = $this->shareDisableChecker->sharingDisabledForUser($self->getUID()); |
177 | 179 | // whether to filter out all users which don't have a common group as the current user |
178 | 180 | $ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; |
179 | 181 |
|
180 | 182 | $selfGroups = $this->groupManager->getUserGroupIds($self); |
181 | | - |
182 | | - if ($excludeGroups && $excludeGroups !== 'no') { |
183 | | - $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
184 | | - $decodedExcludeGroups = json_decode($excludedGroups, true); |
185 | | - $excludeGroupsList = $decodedExcludeGroups ?? []; |
186 | | - |
187 | | - if ($excludeGroups !== 'allow') { |
188 | | - if (count($selfGroups) > 0 && count(array_diff($selfGroups, $excludeGroupsList)) === 0) { |
189 | | - // all the groups of the current user are excluded -> filter all local users |
190 | | - $skipLocal = true; |
191 | | - } |
192 | | - } else { |
193 | | - $skipLocal = true; |
194 | | - if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) { |
195 | | - // a group of the current user is allowed -> do not filter all local users |
196 | | - $skipLocal = false; |
197 | | - } |
198 | | - } |
199 | | - } |
200 | | - |
201 | 183 | // ownGroupsOnly : some groups may be excluded |
202 | 184 | if ($ownGroupsOnly) { |
203 | 185 | $excludeGroupsFromOwnGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); |
|
0 commit comments