aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Share20
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-04-06 10:13:23 +0200
committerGitHub <noreply@github.com>2022-04-06 10:13:23 +0200
commitb8b4d247b4382d7c51323976a3a17e1416dcfe0a (patch)
treedac3acf9277dd007ea3f22712d0c9c29742beb65 /lib/private/Share20
parentd2289519a3284f89f264de4d14aed565b66c46d7 (diff)
parenta29251e02df0157741afaddbc202617e6eb1c840 (diff)
downloadnextcloud-server-b8b4d247b4382d7c51323976a3a17e1416dcfe0a.tar.gz
nextcloud-server-b8b4d247b4382d7c51323976a3a17e1416dcfe0a.zip
Merge pull request #31194 from nextcloud/feat/allow-to-exclude-groups-from-password-enforcement
Allow to disable password policy enforcement for selected groups
Diffstat (limited to 'lib/private/Share20')
-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 2a76ddafb25..3fca9e3fe14 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1783,9 +1783,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';
}