Skip to content

Commit 708c9b3

Browse files
CarlSchwanartonge
andauthored
Update lib/private/Share20/Manager.php
Co-authored-by: Louis <6653109+artonge@users.noreply.github.com>
1 parent 145afe6 commit 708c9b3

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/private/Share20/Manager.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,15 +1788,12 @@ public function shareApiAllowLinks() {
17881788
* @return bool
17891789
*/
17901790
public function shareApiLinkEnforcePassword(bool $checkGroupMembership = true) {
1791-
$excludedGroups = $this->config->getAppValue('core', 'shareapi_enforce_links_password_excluded_groups', '');
1792-
if ($excludedGroups !== '' && $checkGroupMembership) {
1793-
$excludedGroups = json_decode($excludedGroups);
1794-
$user = $this->userSession->getUser();
1795-
if ($user) {
1796-
$userGroups = $this->groupManager->getUserGroupIds($user);
1797-
if ((bool)array_intersect($excludedGroups, $userGroups)) {
1798-
return false;
1799-
}
1791+
$user = $this->userSession->getUser();
1792+
if ($checkGroupMembership && $user !== null) {
1793+
$userGroups = $this->groupManager->getUserGroupIds($user);
1794+
$excludedGroups = json_decode($this->config->getAppValue('core', 'shareapi_enforce_links_password_excluded_groups', '[]'));
1795+
if (count(array_intersect($excludedGroups, $userGroups)) > 0) {
1796+
return false;
18001797
}
18011798
}
18021799
return $this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes';

0 commit comments

Comments
 (0)