Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 2aa4d099024..b634d41a640 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1784,9 +1784,21 @@ class Manager implements IManager {
/**
* Is password on public link requires
*
+ * @param bool Check group membership exclusion
* @return bool
*/
- public function shareApiLinkEnforcePassword() {
+ public function shareApiLinkEnforcePassword(bool $checkGroupMembership = true) {
+ $excludedGroups = $this->config->getAppValue('core', 'shareapi_enforce_links_password_excluded_groups', '');
+ if ($excludedGroups !== '' && $checkGroupMembership) {
+ $excludedGroups = json_decode($excludedGroups);
+ $user = $this->userSession->getUser();
+ if ($user) {
+ $userGroups = $this->groupManager->getUserGroupIds($user);
+ if ((bool)array_intersect($excludedGroups, $userGroups)) {
+ return false;
+ }
+ }
+ }
return $this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes';
}