From 40da0421520647131ca1699a8b77d164ef8ab899 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Fri, 28 Apr 2023 16:06:29 +0200 Subject: [PATCH 01/16] New core setting : shareapi_only_share_with_group_members_exclude_group_list (issue 37677) Signed-off-by: Sebastien Marinier --- apps/settings/l10n/en_GB.js | 1 + apps/settings/l10n/en_GB.json | 1 + apps/settings/l10n/fr.js | 1 + apps/settings/l10n/fr.json | 1 + apps/settings/lib/Settings/Admin/Sharing.php | 4 +++ apps/settings/src/admin.js | 6 ++++- .../templates/settings/admin/sharing.php | 7 +++++ .../Collaborators/GroupPlugin.php | 13 ++++++++++ .../Collaborators/MailPlugin.php | 14 ++++++++++ .../Collaborators/UserPlugin.php | 14 ++++++++++ .../Contacts/ContactsMenu/ContactsStore.php | 11 ++++++++ lib/private/Share20/Manager.php | 26 ++++++++++++++++++- lib/public/Share/IManager.php | 9 +++++++ 13 files changed, 106 insertions(+), 2 deletions(-) diff --git a/apps/settings/l10n/en_GB.js b/apps/settings/l10n/en_GB.js index c814a0c8de8c3..d77bd409df52a 100644 --- a/apps/settings/l10n/en_GB.js +++ b/apps/settings/l10n/en_GB.js @@ -525,6 +525,7 @@ OC.L10N.register( "Allow resharing" : "Allow resharing", "Allow sharing with groups" : "Allow sharing with groups", "Restrict users to only share with users in their groups" : "Restrict users to only share with users in their groups", + "Exclude some groups from sharing with users in their group" : "Exclude some groups from sharing with users in their group", "Exclude groups from sharing" : "Exclude groups from sharing", "These groups will still be able to receive shares, but not to initiate them." : "These groups will still be able to receive shares, but not to initiate them.", "Allow username autocompletion in share dialog and allow access to the system address book" : "Allow username autocompletion in share dialog and allow access to the system address book", diff --git a/apps/settings/l10n/en_GB.json b/apps/settings/l10n/en_GB.json index e83120288c505..12c54d246869d 100644 --- a/apps/settings/l10n/en_GB.json +++ b/apps/settings/l10n/en_GB.json @@ -523,6 +523,7 @@ "Allow resharing" : "Allow resharing", "Allow sharing with groups" : "Allow sharing with groups", "Restrict users to only share with users in their groups" : "Restrict users to only share with users in their groups", + "Exclude some groups from sharing with users in their group" : "Exclude some groups from sharing with users in their group", "Exclude groups from sharing" : "Exclude groups from sharing", "These groups will still be able to receive shares, but not to initiate them." : "These groups will still be able to receive shares, but not to initiate them.", "Allow username autocompletion in share dialog and allow access to the system address book" : "Allow username autocompletion in share dialog and allow access to the system address book", diff --git a/apps/settings/l10n/fr.js b/apps/settings/l10n/fr.js index 2b15c7c659daf..f16ecde58a428 100644 --- a/apps/settings/l10n/fr.js +++ b/apps/settings/l10n/fr.js @@ -516,6 +516,7 @@ OC.L10N.register( "Allow resharing" : "Autoriser le repartage", "Allow sharing with groups" : "Autoriser le partage avec les groupes", "Restrict users to only share with users in their groups" : "N'autoriser les partages qu'entre membres de mêmes groupes", + "Exclude some groups from sharing with users in their group" : "Empêcher certains groupes de partager avec les utilisateurs de leur groupe", "Exclude groups from sharing" : "Empêcher certains groupes de partager", "These groups will still be able to receive shares, but not to initiate them." : "Ces groupes ne pourront plus initier de partage, mais ils pourront toujours rejoindre les partages faits par d'autres. ", "Allow username autocompletion in share dialog and allow access to the system address book" : "Autoriser l'autocomplétion du nom d'utilisateur dans le dialogue de partage et permettre l'accès au carnet d'adresses du système", diff --git a/apps/settings/l10n/fr.json b/apps/settings/l10n/fr.json index 805f7ad2846d7..6338eefebf1fb 100644 --- a/apps/settings/l10n/fr.json +++ b/apps/settings/l10n/fr.json @@ -514,6 +514,7 @@ "Allow resharing" : "Autoriser le repartage", "Allow sharing with groups" : "Autoriser le partage avec les groupes", "Restrict users to only share with users in their groups" : "N'autoriser les partages qu'entre membres de mêmes groupes", + "Exclude some groups from sharing with users in their group" : "Empêcher certains groupes de partager avec les utilisateurs de leur groupe", "Exclude groups from sharing" : "Empêcher certains groupes de partager", "These groups will still be able to receive shares, but not to initiate them." : "Ces groupes ne pourront plus initier de partage, mais ils pourront toujours rejoindre les partages faits par d'autres. ", "Allow username autocompletion in share dialog and allow access to the system address book" : "Autoriser l'autocomplétion du nom d'utilisateur dans le dialogue de partage et permettre l'accès au carnet d'adresses du système", diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index 32b09f333a9c6..9f4139e8a2bfc 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -76,6 +76,9 @@ public function getForm() { $excludedPasswordGroupsList = !is_null(json_decode($excludedPasswordGroups)) ? implode('|', json_decode($excludedPasswordGroups, true)) : ''; + $shareWithGroupMembersExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); + $shareWithGroupMembersExcludeGroupsList = !is_null(json_decode($shareWithGroupMembersExcludeGroups)) + ? implode('|', json_decode($shareWithGroupMembersExcludeGroups, true)) : ''; $parameters = [ // Built-In Sharing @@ -96,6 +99,7 @@ public function getForm() { 'passwordExcludedGroups' => $excludedPasswordGroupsList, 'passwordExcludedGroupsFeatureEnabled' => $this->config->getSystemValueBool('sharing.allow_disabled_password_enforcement_groups', false), 'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(), + 'shareWithGroupMembersExcludeGroupsList'=> $shareWithGroupMembersExcludeGroupsList, 'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'), 'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'), 'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'), diff --git a/apps/settings/src/admin.js b/apps/settings/src/admin.js index c8d04049ded06..c15e8dc343209 100644 --- a/apps/settings/src/admin.js +++ b/apps/settings/src/admin.js @@ -1,5 +1,5 @@ window.addEventListener('DOMContentLoaded', () => { - $('#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) { + $('#excludedGroups,#shareGroupMembersExcludeGroups,#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) { OC.Settings.setupGroupsSelect($(element)) $(element).change(function(ev) { let groups = ev.val || [] @@ -229,6 +229,10 @@ window.addEventListener('DOMContentLoaded', () => { $('#selectExcludedGroups').toggleClass('hidden', !this.checked) }) + $('#onlyShareWithGroupMembers').change(function() { + $('#selectShareWithGroupMembersExcludeGroups').toggleClass('hidden', !this.checked) + }) + const setupChecks = () => { // run setup checks then gather error messages $.when( diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index 2918a764d89ac..fa21e7d5f83c9 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -187,6 +187,13 @@ } ?> />

+

+ t('Exclude some groups from sharing with users in their group')); ?> +
+ +

diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index 75e52c19e0b27..8b18bf248e2a0 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -45,6 +45,8 @@ class GroupPlugin implements ISearchPlugin { protected $shareeEnumerationInGroupOnly; /** @var bool */ protected $groupSharingDisabled; + /** @var array */ + protected $shareWithGroupOnlyExcludeGroupsList; /** @var IGroupManager */ private $groupManager; @@ -62,6 +64,14 @@ public function __construct(IConfig $config, IGroupManager $groupManager, IUserS $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; $this->shareeEnumerationInGroupOnly = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes'; $this->groupSharingDisabled = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'no'; + + if ($this->shareWithGroupOnly) { + $shareWithGroupOnlyExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); + $decodedExcludeGroups = json_decode($shareWithGroupOnlyExcludeGroups, true); + $this->shareWithGroupOnlyExcludeGroupsList = $decodedExcludeGroups ?? []; + } else { + $this->shareWithGroupOnlyExcludeGroupsList = []; + } } public function search($search, $limit, $offset, ISearchResult $searchResult) { @@ -89,6 +99,9 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { return $group->getGID(); }, $userGroups); $groupIds = array_intersect($groupIds, $userGroups); + + // ShareWithGroupOnly filtering + $groupIds = array_diff( $groupIds, $this->shareWithGroupOnlyExcludeGroupsList); } $lowerSearch = strtolower($search); diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index aa317ec17204f..f20b5cebba0ed 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -53,6 +53,8 @@ class MailPlugin implements ISearchPlugin { protected $shareeEnumerationFullMatch; /* @var bool */ protected $shareeEnumerationFullMatchEmail; + /** @var array */ + protected $shareWithGroupOnlyExcludeGroupsList; /** @var IManager */ private $contactsManager; @@ -91,6 +93,14 @@ public function __construct(IManager $contactsManager, $this->shareeEnumerationPhone = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes'; $this->shareeEnumerationFullMatch = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match', 'yes') === 'yes'; $this->shareeEnumerationFullMatchEmail = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes'; + + if ($this->shareWithGroupOnly) { + $shareWithGroupOnlyExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); + $decodedExcludeGroups = json_decode($shareWithGroupOnlyExcludeGroups, true); + $this->shareWithGroupOnlyExcludeGroupsList = $decodedExcludeGroups ?? []; + } else { + $this->shareWithGroupOnlyExcludeGroupsList = []; + } } /** @@ -150,6 +160,10 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { * Check if the user may share with the user associated with the e-mail of the just found contact */ $userGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser()); + + // ShareWithGroupOnly filtering + $userGroups = array_diff( $userGroups, $this->shareWithGroupOnlyExcludeGroupsList); + $found = false; foreach ($userGroups as $userGroup) { if ($this->groupManager->isInGroup($contact['UID'], $userGroup)) { diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 9beecdaa6cbbf..726a7099e8a3f 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -60,6 +60,8 @@ class UserPlugin implements ISearchPlugin { protected $shareeEnumerationFullMatchEmail; /* @var bool */ protected $shareeEnumerationFullMatchIgnoreSecondDisplayName; + /** @var array */ + protected $shareWithGroupOnlyExcludeGroupsList; /** @var IConfig */ private $config; @@ -96,6 +98,14 @@ public function __construct(IConfig $config, $this->shareeEnumerationFullMatchUserId = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes') === 'yes'; $this->shareeEnumerationFullMatchEmail = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes'; $this->shareeEnumerationFullMatchIgnoreSecondDisplayName = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no') === 'yes'; + + if ($this->shareWithGroupOnly) { + $shareWithGroupOnlyExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); + $decodedExcludeGroups = json_decode($shareWithGroupOnlyExcludeGroups, true); + $this->shareWithGroupOnlyExcludeGroupsList = $decodedExcludeGroups ?? []; + } else { + $this->shareWithGroupOnlyExcludeGroupsList = []; + } } public function search($search, $limit, $offset, ISearchResult $searchResult) { @@ -105,6 +115,10 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { $currentUserId = $this->userSession->getUser()->getUID(); $currentUserGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser()); + + // ShareWithGroupOnly filtering + $currentUserGroups = array_diff( $currentUserGroups, $this->shareWithGroupOnlyExcludeGroupsList); + if ($this->shareWithGroupOnly || $this->shareeEnumerationInGroupOnly) { // Search in all the groups this user is part of foreach ($currentUserGroups as $userGroupId) { diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index c692b486ae404..4a89cda101a28 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -108,6 +108,9 @@ public function getContacts(IUser $user, ?string $filter, ?int $limit = null, ?i * 3. if the `shareapi_only_share_with_group_members` config option is * enabled it will filter all users which doesn't have a common group * with the current user. + * If enabled, the 'shareapi_only_share_with_group_members_exclude_group_list' + * config option may specify some groups excluded from the principle of + * belonging to the same group. * * @param Entry[] $entries * @return Entry[] the filtered contacts @@ -141,6 +144,14 @@ private function filterContacts( } } + // ownGroupsOnly : some groups may be excluded + if ($ownGroupsOnly) { + $excludeGroupsFromOwnGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); + $decodedExcludeGroupsFromOwnGroups = json_decode($excludeGroupsFromOwnGroups, true); + $excludeGroupsFromOwnGroupsList = $decodedExcludeGroupsFromOwnGroups ?? []; + $selfGroups = array_diff( $selfGroups, $excludeGroupsFromOwnGroupsList); + } + $selfUID = $self->getUID(); return array_values(array_filter($entries, function (IEntry $entry) use ($skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $restrictEnumerationGroup, $restrictEnumerationPhone, $allowEnumerationFullMatch, $filter) { diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 9360046bc248e..a5564412949bd 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -549,6 +549,11 @@ protected function userCreateChecks(IShare $share) { $this->groupManager->getUserGroupIds($sharedBy), $this->groupManager->getUserGroupIds($sharedWith) ); + + // optional excluded groups + $excludedGroups = $this->shareWithGroupMembersOnlyExcludedGroupsList(); + $groups = array_diff($groups, $excludedGroups); + if (empty($groups)) { $message_t = $this->l->t('Sharing is only allowed with group members'); throw new \Exception($message_t); @@ -609,7 +614,10 @@ protected function groupCreateChecks(IShare $share) { if ($this->shareWithGroupMembersOnly()) { $sharedBy = $this->userManager->get($share->getSharedBy()); $sharedWith = $this->groupManager->get($share->getSharedWith()); - if (is_null($sharedWith) || !$sharedWith->inGroup($sharedBy)) { + + // optional excluded groups + $excludedGroups = $this->shareWithGroupMembersOnlyExcludedGroupsList(); + if (is_null($sharedWith) || in_array($share->getSharedWith(), $excludedGroups) || !$sharedWith->inGroup($sharedBy)) { throw new \Exception('Sharing is only allowed within your own groups'); } } @@ -1931,6 +1939,22 @@ public function shareWithGroupMembersOnly() { return $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; } + /** + * If shareWithGroupMembersOnly is enabled, return an optional + * list of groups that must be excluded from the principle of + * belonging to the same group. + * + * @return array + */ + public function shareWithGroupMembersOnlyExcludedGroupsList() { + if (!$this->shareWithGroupMembersOnly()) { + return []; + } + $excludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); + $decodedExcludeGroups = json_decode($excludeGroups, true); + return $decodedExcludeGroups ?? []; + } + /** * Check if users can share with groups * diff --git a/lib/public/Share/IManager.php b/lib/public/Share/IManager.php index 9ac224ed7ef30..f951cf8106ae3 100644 --- a/lib/public/Share/IManager.php +++ b/lib/public/Share/IManager.php @@ -415,6 +415,15 @@ public function shareApiLinkAllowPublicUpload(); */ public function shareWithGroupMembersOnly(); + /** + * If shareWithGroupMembersOnly is enabled, return an optional + * list of groups that must be excluded from the principle of + * belonging to the same group. + * @return array + * @since 27.0.0 + */ + public function shareWithGroupMembersOnlyExcludedGroupsList(); + /** * Check if users can share with groups * @return bool From f9862e22a12f622ed437f2bc7d97e7b4e4a77888 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Wed, 10 May 2023 16:39:11 +0200 Subject: [PATCH 02/16] no i18n files in PR Signed-off-by: Sebastien Marinier --- apps/settings/l10n/en_GB.js | 1 - apps/settings/l10n/en_GB.json | 3 +-- apps/settings/l10n/fr.js | 1 - apps/settings/l10n/fr.json | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/settings/l10n/en_GB.js b/apps/settings/l10n/en_GB.js index d77bd409df52a..c814a0c8de8c3 100644 --- a/apps/settings/l10n/en_GB.js +++ b/apps/settings/l10n/en_GB.js @@ -525,7 +525,6 @@ OC.L10N.register( "Allow resharing" : "Allow resharing", "Allow sharing with groups" : "Allow sharing with groups", "Restrict users to only share with users in their groups" : "Restrict users to only share with users in their groups", - "Exclude some groups from sharing with users in their group" : "Exclude some groups from sharing with users in their group", "Exclude groups from sharing" : "Exclude groups from sharing", "These groups will still be able to receive shares, but not to initiate them." : "These groups will still be able to receive shares, but not to initiate them.", "Allow username autocompletion in share dialog and allow access to the system address book" : "Allow username autocompletion in share dialog and allow access to the system address book", diff --git a/apps/settings/l10n/en_GB.json b/apps/settings/l10n/en_GB.json index 12c54d246869d..73279a593769c 100644 --- a/apps/settings/l10n/en_GB.json +++ b/apps/settings/l10n/en_GB.json @@ -523,7 +523,6 @@ "Allow resharing" : "Allow resharing", "Allow sharing with groups" : "Allow sharing with groups", "Restrict users to only share with users in their groups" : "Restrict users to only share with users in their groups", - "Exclude some groups from sharing with users in their group" : "Exclude some groups from sharing with users in their group", "Exclude groups from sharing" : "Exclude groups from sharing", "These groups will still be able to receive shares, but not to initiate them." : "These groups will still be able to receive shares, but not to initiate them.", "Allow username autocompletion in share dialog and allow access to the system address book" : "Allow username autocompletion in share dialog and allow access to the system address book", @@ -571,4 +570,4 @@ "User's table" : "User's table", "Select user manager" : "Select user manager" },"pluralForm" :"nplurals=2; plural=(n != 1);" -} \ No newline at end of file +} diff --git a/apps/settings/l10n/fr.js b/apps/settings/l10n/fr.js index f16ecde58a428..2b15c7c659daf 100644 --- a/apps/settings/l10n/fr.js +++ b/apps/settings/l10n/fr.js @@ -516,7 +516,6 @@ OC.L10N.register( "Allow resharing" : "Autoriser le repartage", "Allow sharing with groups" : "Autoriser le partage avec les groupes", "Restrict users to only share with users in their groups" : "N'autoriser les partages qu'entre membres de mêmes groupes", - "Exclude some groups from sharing with users in their group" : "Empêcher certains groupes de partager avec les utilisateurs de leur groupe", "Exclude groups from sharing" : "Empêcher certains groupes de partager", "These groups will still be able to receive shares, but not to initiate them." : "Ces groupes ne pourront plus initier de partage, mais ils pourront toujours rejoindre les partages faits par d'autres. ", "Allow username autocompletion in share dialog and allow access to the system address book" : "Autoriser l'autocomplétion du nom d'utilisateur dans le dialogue de partage et permettre l'accès au carnet d'adresses du système", diff --git a/apps/settings/l10n/fr.json b/apps/settings/l10n/fr.json index 6338eefebf1fb..445a394578bb1 100644 --- a/apps/settings/l10n/fr.json +++ b/apps/settings/l10n/fr.json @@ -514,7 +514,6 @@ "Allow resharing" : "Autoriser le repartage", "Allow sharing with groups" : "Autoriser le partage avec les groupes", "Restrict users to only share with users in their groups" : "N'autoriser les partages qu'entre membres de mêmes groupes", - "Exclude some groups from sharing with users in their group" : "Empêcher certains groupes de partager avec les utilisateurs de leur groupe", "Exclude groups from sharing" : "Empêcher certains groupes de partager", "These groups will still be able to receive shares, but not to initiate them." : "Ces groupes ne pourront plus initier de partage, mais ils pourront toujours rejoindre les partages faits par d'autres. ", "Allow username autocompletion in share dialog and allow access to the system address book" : "Autoriser l'autocomplétion du nom d'utilisateur dans le dialogue de partage et permettre l'accès au carnet d'adresses du système", @@ -562,4 +561,4 @@ "User's table" : "Tableau des utilisateurs", "Select user manager" : "Sélectionner le gestionnaire des utilisateurs" },"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" -} \ No newline at end of file +} From 0d8757b3d3c72098dd93dffd9180290daa506fd5 Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Wed, 11 Oct 2023 19:05:15 +0200 Subject: [PATCH 03/16] fix(php): Add a property in Collaborators classes I added the $shareWithGroupOnlyExcludeGroupsList variable as a property in the Collaborators classes and fix the CI (Psalm). Signed-off-by: Baptiste Fotia --- lib/private/Collaboration/Collaborators/GroupPlugin.php | 1 + lib/private/Collaboration/Collaborators/MailPlugin.php | 1 + lib/private/Collaboration/Collaborators/UserPlugin.php | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index 2c17b6d3e254d..c57dbf5c6dad7 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -49,6 +49,7 @@ public function __construct( private IConfig $config, private IGroupManager $groupManager, private IUserSession $userSession, + private mixed $shareWithGroupOnlyExcludeGroupsList, ) { $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 28f3fd56e0b03..c02f5ef56cb23 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -61,6 +61,7 @@ public function __construct( private KnownUserService $knownUserService, private IUserSession $userSession, private IMailer $mailer, + private mixed $shareWithGroupOnlyExcludeGroupsList, ) { $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 09c0dd4f3b7ce..b49ca1e50ed2e 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -67,6 +67,7 @@ public function __construct( private IUserSession $userSession, private KnownUserService $knownUserService, private IUserStatusManager $userStatusManager, + private mixed $shareWithGroupOnlyExcludeGroupsList, ) { $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; From b6db12eb7f27486ff253bd50512e2dbcf685208c Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Thu, 12 Oct 2023 10:26:40 +0200 Subject: [PATCH 04/16] style(php): Run composer cs:fix I ran composer cs:fix for files from Collaborators folder and the ContactsStore.php file. Signed-off-by: Baptiste Fotia --- lib/private/Collaboration/Collaborators/GroupPlugin.php | 2 +- lib/private/Collaboration/Collaborators/MailPlugin.php | 2 +- lib/private/Collaboration/Collaborators/UserPlugin.php | 2 +- lib/private/Contacts/ContactsMenu/ContactsStore.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index c57dbf5c6dad7..b4d513b26daf5 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -92,7 +92,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b $groupIds = array_intersect($groupIds, $userGroups); // ShareWithGroupOnly filtering - $groupIds = array_diff( $groupIds, $this->shareWithGroupOnlyExcludeGroupsList); + $groupIds = array_diff($groupIds, $this->shareWithGroupOnlyExcludeGroupsList); } $lowerSearch = strtolower($search); diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index c02f5ef56cb23..34890a30dd2e7 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -138,7 +138,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b $userGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser()); // ShareWithGroupOnly filtering - $userGroups = array_diff( $userGroups, $this->shareWithGroupOnlyExcludeGroupsList); + $userGroups = array_diff($userGroups, $this->shareWithGroupOnlyExcludeGroupsList); $found = false; foreach ($userGroups as $userGroup) { diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index b49ca1e50ed2e..c76e86e615a15 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -96,7 +96,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b $currentUserGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser()); // ShareWithGroupOnly filtering - $currentUserGroups = array_diff( $currentUserGroups, $this->shareWithGroupOnlyExcludeGroupsList); + $currentUserGroups = array_diff($currentUserGroups, $this->shareWithGroupOnlyExcludeGroupsList); if ($this->shareWithGroupOnly || $this->shareeEnumerationInGroupOnly) { // Search in all the groups this user is part of diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index 4a89cda101a28..d12a587774b26 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -149,7 +149,7 @@ private function filterContacts( $excludeGroupsFromOwnGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); $decodedExcludeGroupsFromOwnGroups = json_decode($excludeGroupsFromOwnGroups, true); $excludeGroupsFromOwnGroupsList = $decodedExcludeGroupsFromOwnGroups ?? []; - $selfGroups = array_diff( $selfGroups, $excludeGroupsFromOwnGroupsList); + $selfGroups = array_diff($selfGroups, $excludeGroupsFromOwnGroupsList); } $selfUID = $self->getUID(); From 31f8a28f07b00491643894dd5a0a5859b1ca52bd Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Thu, 12 Oct 2023 11:08:50 +0200 Subject: [PATCH 05/16] revert(json): Delete end of line I deleted end of line for en_GB.json and fr.json files. Signed-off-by: Baptiste Fotia --- apps/settings/l10n/en_GB.json | 2 +- apps/settings/l10n/fr.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/settings/l10n/en_GB.json b/apps/settings/l10n/en_GB.json index bdc926a86f912..e7decc537224e 100644 --- a/apps/settings/l10n/en_GB.json +++ b/apps/settings/l10n/en_GB.json @@ -585,4 +585,4 @@ "User's table" : "User's table", "Select user manager" : "Select user manager" },"pluralForm" :"nplurals=2; plural=(n != 1);" -} +} \ No newline at end of file diff --git a/apps/settings/l10n/fr.json b/apps/settings/l10n/fr.json index b05050e33d009..bfdd6e74ee503 100644 --- a/apps/settings/l10n/fr.json +++ b/apps/settings/l10n/fr.json @@ -580,4 +580,4 @@ "User's table" : "Tableau des utilisateurs", "Select user manager" : "Sélectionner le gestionnaire des utilisateurs" },"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" -} +} \ No newline at end of file From fdba09b0029951b05cee14338b499cce3ccff1bf Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Fri, 6 Oct 2023 18:35:41 +0200 Subject: [PATCH 06/16] Modify settings label Modify settings label (shareapi_only_share_with_group_members_exclude_group_list) accordingly to last discussions Signed-off-by: Sebastien Marinier --- apps/settings/templates/settings/admin/sharing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index fa21e7d5f83c9..66e346209e8fe 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -190,7 +190,7 @@

- t('Exclude some groups from sharing with users in their group')); ?> + t('Ignore the following groups when checking group membership')); ?>

From b78dc806d9670d8b22d84b6949aefd8a31eda42c Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Mon, 11 Sep 2023 19:07:46 +0200 Subject: [PATCH 07/16] Resolve conflict Conflict with 06d8a03315fd72a72229fb48a096e514e3e5b3b0 Signed-off-by: Sebastien Marinier --- apps/settings/src/admin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/settings/src/admin.js b/apps/settings/src/admin.js index c15e8dc343209..1af1cb2d708af 100644 --- a/apps/settings/src/admin.js +++ b/apps/settings/src/admin.js @@ -1,5 +1,5 @@ window.addEventListener('DOMContentLoaded', () => { - $('#excludedGroups,#shareGroupMembersExcludeGroups,#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) { + $('#shareGroupMembersExcludeGroups,#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) { OC.Settings.setupGroupsSelect($(element)) $(element).change(function(ev) { let groups = ev.val || [] From 27e9f745859e52f9d8be04d122ddabab0998b263 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Sun, 13 Aug 2023 15:57:22 +0200 Subject: [PATCH 08/16] Fix unit test performance (nodb) Add shareWithGroupMembersExcludeGroupsList in default settings Signed-off-by: Sebastien Marinier --- apps/settings/tests/Settings/Admin/SharingTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index c0b5861f549e5..a9e8a6a4a5471 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -144,6 +144,7 @@ public function testGetFormWithoutExcludedGroups(): void { 'allowLinksExcludeGroups' => '', 'passwordExcludedGroups' => '', 'passwordExcludedGroupsFeatureEnabled' => false, + 'shareWithGroupMembersExcludeGroupsList' => '', ], '' ); @@ -226,6 +227,7 @@ public function testGetFormWithExcludedGroups(): void { 'allowLinksExcludeGroups' => '', 'passwordExcludedGroups' => '', 'passwordExcludedGroupsFeatureEnabled' => false, + 'shareWithGroupMembersExcludeGroupsList' => '', ], '' ); From 08cdbb4dc1dd59cd2f4467f86e8a91d0ce5ee229 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Sun, 13 Aug 2023 11:47:08 +0200 Subject: [PATCH 09/16] Fix unit test with shareapi_only_share_with_group_members_exclude_group_list Prevent json_decode(null) from config mock (getAppValue) Signed-off-by: Sebastien Marinier --- tests/lib/Share20/ManagerTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index c770181799f0f..eaa26ef7e856e 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -1569,6 +1569,7 @@ public function testUserCreateChecksShareWithGroupMembersOnlyDifferentGroups() { ->method('getAppValue') ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], + ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'], ]); self::invokePrivate($this->manager, 'userCreateChecks', [$share]); @@ -1602,6 +1603,7 @@ public function testUserCreateChecksShareWithGroupMembersOnlySharedGroup() { ->method('getAppValue') ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], + ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'], ]); $this->defaultProvider @@ -1794,6 +1796,7 @@ public function testGroupCreateChecksShareWithGroupMembersOnlyNotInGroup() { ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], + ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'], ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); @@ -1817,6 +1820,7 @@ public function testGroupCreateChecksShareWithGroupMembersOnlyNullGroup() { ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], + ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'], ]); $this->assertNull($this->invokePrivate($this->manager, 'groupCreateChecks', [$share])); @@ -1846,6 +1850,7 @@ public function testGroupCreateChecksShareWithGroupMembersOnlyInGroup() { ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], + ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'], ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); From 733c23334c30c9038f703cb7a8a7d73bafc956f0 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Mon, 26 Jun 2023 14:15:39 +0200 Subject: [PATCH 10/16] Fix lint Fixed lint errors (php-cs-fixer) Signed-off-by: Sebastien Marinier --- lib/private/Contacts/ContactsMenu/ContactsStore.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index d12a587774b26..5628301a3254d 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -147,8 +147,7 @@ private function filterContacts( // ownGroupsOnly : some groups may be excluded if ($ownGroupsOnly) { $excludeGroupsFromOwnGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); - $decodedExcludeGroupsFromOwnGroups = json_decode($excludeGroupsFromOwnGroups, true); - $excludeGroupsFromOwnGroupsList = $decodedExcludeGroupsFromOwnGroups ?? []; + $excludeGroupsFromOwnGroupsList = json_decode($excludeGroupsFromOwnGroups, true) ?? []; $selfGroups = array_diff($selfGroups, $excludeGroupsFromOwnGroupsList); } From aeb2ee15fc5fc6aabcd7de8a8ff52ca37aa796f1 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Fri, 16 Jun 2023 18:29:07 +0200 Subject: [PATCH 11/16] Fix PR comments Reduce redundant code lines, harmonize function name, use wording chosen with dicsussion Signed-off-by: Sebastien Marinier no i18n files in PR Signed-off-by: Sebastien Marinier refactor(l10n): no line break in the end file I removed the line breaks in the end file of en_GB.json and fr.json files. Signed-off-by: Baptiste Fotia --- apps/settings/templates/settings/admin/sharing.php | 2 +- lib/private/Collaboration/Collaborators/GroupPlugin.php | 4 +--- lib/private/Collaboration/Collaborators/MailPlugin.php | 4 +--- lib/private/Collaboration/Collaborators/UserPlugin.php | 4 +--- lib/private/Share20/Manager.php | 9 ++++----- lib/public/Share/IManager.php | 2 +- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index 66e346209e8fe..04ae6f3da73df 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -190,7 +190,7 @@

- t('Ignore the following groups when checking group membership')); ?> + t('Ignore these groups for the sharing restriction')); ?>

diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index b4d513b26daf5..27a0e45357c3a 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -57,9 +57,7 @@ public function __construct( $this->groupSharingDisabled = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'no'; if ($this->shareWithGroupOnly) { - $shareWithGroupOnlyExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); - $decodedExcludeGroups = json_decode($shareWithGroupOnlyExcludeGroups, true); - $this->shareWithGroupOnlyExcludeGroupsList = $decodedExcludeGroups ?? []; + $this->shareWithGroupOnlyExcludeGroupsList = json_decode($this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''), true) ?? []; } else { $this->shareWithGroupOnlyExcludeGroupsList = []; } diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 34890a30dd2e7..4477c32756ef2 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -71,9 +71,7 @@ public function __construct( $this->shareeEnumerationFullMatchEmail = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes'; if ($this->shareWithGroupOnly) { - $shareWithGroupOnlyExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); - $decodedExcludeGroups = json_decode($shareWithGroupOnlyExcludeGroups, true); - $this->shareWithGroupOnlyExcludeGroupsList = $decodedExcludeGroups ?? []; + $this->shareWithGroupOnlyExcludeGroupsList = json_decode($this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''), true) ?? []; } else { $this->shareWithGroupOnlyExcludeGroupsList = []; } diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index c76e86e615a15..b70eac95573c6 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -79,9 +79,7 @@ public function __construct( $this->shareeEnumerationFullMatchIgnoreSecondDisplayName = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no') === 'yes'; if ($this->shareWithGroupOnly) { - $shareWithGroupOnlyExcludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); - $decodedExcludeGroups = json_decode($shareWithGroupOnlyExcludeGroups, true); - $this->shareWithGroupOnlyExcludeGroupsList = $decodedExcludeGroups ?? []; + $this->shareWithGroupOnlyExcludeGroupsList = json_decode($this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''), true) ?? []; } else { $this->shareWithGroupOnlyExcludeGroupsList = []; } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 33aa1aa7704e6..be00fe679f75e 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -550,7 +550,7 @@ protected function userCreateChecks(IShare $share) { ); // optional excluded groups - $excludedGroups = $this->shareWithGroupMembersOnlyExcludedGroupsList(); + $excludedGroups = $this->shareWithGroupMembersOnlyExcludeGroupsList(); $groups = array_diff($groups, $excludedGroups); if (empty($groups)) { @@ -615,7 +615,7 @@ protected function groupCreateChecks(IShare $share) { $sharedWith = $this->groupManager->get($share->getSharedWith()); // optional excluded groups - $excludedGroups = $this->shareWithGroupMembersOnlyExcludedGroupsList(); + $excludedGroups = $this->shareWithGroupMembersOnlyExcludeGroupsList(); if (is_null($sharedWith) || in_array($share->getSharedWith(), $excludedGroups) || !$sharedWith->inGroup($sharedBy)) { throw new \Exception('Sharing is only allowed within your own groups'); } @@ -1959,13 +1959,12 @@ public function shareWithGroupMembersOnly() { * * @return array */ - public function shareWithGroupMembersOnlyExcludedGroupsList() { + public function shareWithGroupMembersOnlyExcludeGroupsList() { if (!$this->shareWithGroupMembersOnly()) { return []; } $excludeGroups = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); - $decodedExcludeGroups = json_decode($excludeGroups, true); - return $decodedExcludeGroups ?? []; + return json_decode($excludeGroups, true) ?? []; } /** diff --git a/lib/public/Share/IManager.php b/lib/public/Share/IManager.php index f951cf8106ae3..07517dd7eb5e6 100644 --- a/lib/public/Share/IManager.php +++ b/lib/public/Share/IManager.php @@ -422,7 +422,7 @@ public function shareWithGroupMembersOnly(); * @return array * @since 27.0.0 */ - public function shareWithGroupMembersOnlyExcludedGroupsList(); + public function shareWithGroupMembersOnlyExcludeGroupsList(); /** * Check if users can share with groups From 0600c7ec94cfea02bc8122075109adf247c7f73a Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Mon, 16 Oct 2023 12:50:21 +0200 Subject: [PATCH 12/16] chore(php): Change the setting label Signed-off-by: Baptiste Fotia --- apps/settings/templates/settings/admin/sharing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index 04ae6f3da73df..66e346209e8fe 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -190,7 +190,7 @@

- t('Ignore these groups for the sharing restriction')); ?> + t('Ignore the following groups when checking group membership')); ?>

From f9f58f8d5fcaec279cd09d1926035439e3df481a Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Wed, 18 Oct 2023 16:00:35 +0200 Subject: [PATCH 13/16] fix(php): Init the var with an empty array I initialized the `$shareWithGroupOnlyExcludeGroupsList` var in the constructor with an empty array. Signed-off-by: Baptiste Fotia --- lib/private/Collaboration/Collaborators/GroupPlugin.php | 4 +--- lib/private/Collaboration/Collaborators/MailPlugin.php | 4 +--- lib/private/Collaboration/Collaborators/UserPlugin.php | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index 27a0e45357c3a..91e665db783a0 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -49,7 +49,7 @@ public function __construct( private IConfig $config, private IGroupManager $groupManager, private IUserSession $userSession, - private mixed $shareWithGroupOnlyExcludeGroupsList, + private mixed $shareWithGroupOnlyExcludeGroupsList = [], ) { $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; @@ -58,8 +58,6 @@ public function __construct( if ($this->shareWithGroupOnly) { $this->shareWithGroupOnlyExcludeGroupsList = json_decode($this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''), true) ?? []; - } else { - $this->shareWithGroupOnlyExcludeGroupsList = []; } } diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 4477c32756ef2..feb0c0b976776 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -61,7 +61,7 @@ public function __construct( private KnownUserService $knownUserService, private IUserSession $userSession, private IMailer $mailer, - private mixed $shareWithGroupOnlyExcludeGroupsList, + private mixed $shareWithGroupOnlyExcludeGroupsList = [], ) { $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; @@ -72,8 +72,6 @@ public function __construct( if ($this->shareWithGroupOnly) { $this->shareWithGroupOnlyExcludeGroupsList = json_decode($this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''), true) ?? []; - } else { - $this->shareWithGroupOnlyExcludeGroupsList = []; } } diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index b70eac95573c6..005b0d0581211 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -67,7 +67,7 @@ public function __construct( private IUserSession $userSession, private KnownUserService $knownUserService, private IUserStatusManager $userStatusManager, - private mixed $shareWithGroupOnlyExcludeGroupsList, + private mixed $shareWithGroupOnlyExcludeGroupsList = [], ) { $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; @@ -80,8 +80,6 @@ public function __construct( if ($this->shareWithGroupOnly) { $this->shareWithGroupOnlyExcludeGroupsList = json_decode($this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''), true) ?? []; - } else { - $this->shareWithGroupOnlyExcludeGroupsList = []; } } From ac613ecdceed6293d24c550a937ee2c8319129ac Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Wed, 18 Oct 2023 18:56:12 +0200 Subject: [PATCH 14/16] build(npm): Compile assets Signed-off-by: Baptiste Fotia --- dist/settings-legacy-admin.js | 4 ++-- dist/settings-legacy-admin.js.map | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/settings-legacy-admin.js b/dist/settings-legacy-admin.js index 906fc15c61753..037bfa5a0bf7f 100644 --- a/dist/settings-legacy-admin.js +++ b/dist/settings-legacy-admin.js @@ -1,2 +1,2 @@ -({39583:function(){var e=this;window.addEventListener("DOMContentLoaded",(function(){$("#linksExcludedGroups,#passwordsExcludedGroups").each((function(e,s){OC.Settings.setupGroupsSelect($(s)),$(s).change((function(e){var s=e.val||[];s=JSON.stringify(s),OCP.AppConfig.setValue("core",$(this).attr("name"),s)}))})),$("#loglevel").change((function(){$.post(OC.generateUrl("/settings/admin/log/level"),{level:$(this).val()},(function(){OC.Log.reload()}))})),$("#shareAPIEnabled").change((function(){$("#shareAPI p:not(#enable)").toggleClass("hidden",!this.checked)})),$("#shareapiExpireAfterNDays").on("input",(function(){this.value=this.value.replace(/\D/g,"")})),$("#shareAPI input:not(.noJSAutoUpdate)").change((function(){var e=$(this).val();"checkbox"===$(this).attr("type")&&(e=this.checked?"yes":"no"),OCP.AppConfig.setValue("core",$(this).attr("name"),e)})),$("#shareapiDefaultExpireDate").change((function(){$("#setDefaultExpireDate").toggleClass("hidden",!this.checked)})),$("#shareapiDefaultInternalExpireDate").change((function(){$("#setDefaultInternalExpireDate").toggleClass("hidden",!this.checked)})),$("#shareapiDefaultRemoteExpireDate").change((function(){$("#setDefaultRemoteExpireDate").toggleClass("hidden",!this.checked)})),$("#enableLinkPasswordByDefault").change((function(){this.checked?($("#enforceLinkPassword").removeAttr("disabled"),$("#passwordsExcludedGroups").removeAttr("disabled")):($("#enforceLinkPassword").attr("disabled",""),$("#passwordsExcludedGroups").attr("disabled",""),$("#enforceLinkPassword").removeAttr("checked").trigger("change"))})),$("#enforceLinkPassword").change((function(){$("#selectPasswordsExcludedGroups").toggleClass("hidden",!this.checked)})),$("#publicShareDisclaimer").change((function(){$("#publicShareDisclaimerText").toggleClass("hidden",!this.checked),this.checked||s("")})),$("#shareApiDefaultPermissionsSection input").change((function(e){var s=$("#shareApiDefaultPermissions"),t=$(e.target),i=s.val();return t.is(":checked")?i|=t.val():i&=~t.val(),i|=OC.PERMISSION_READ,s.val(i).change(),e.preventDefault(),!1}));var s=_.debounce((function(e){var s={success:function(){OC.msg.finishedSuccess("#publicShareDisclaimerStatus",t("settings","Saved"))},error:function(){OC.msg.finishedError("#publicShareDisclaimerStatus",t("settings","Not saved"))}};OC.msg.startSaving("#publicShareDisclaimerStatus"),_.isString(e)&&""!==e?OCP.AppConfig.setValue("core","shareapi_public_link_disclaimertext",e,s):($("#publicShareDisclaimerText").val(""),OCP.AppConfig.deleteKey("core","shareapi_public_link_disclaimertext",s))}),500);$("#publicShareDisclaimerText").on("change, keyup",(function(){s(this.value)})),$("#shareapi_allow_share_dialog_user_enumeration").on("change",(function(){$("#shareapi_restrict_user_enumeration_to_group_setting").toggleClass("hidden",!this.checked),$("#shareapi_restrict_user_enumeration_to_phone_setting").toggleClass("hidden",!this.checked),$("#shareapi_restrict_user_enumeration_combinewarning_setting").toggleClass("hidden",!this.checked)})),$("#allowLinks").change((function(){$("#publicLinkSettings").toggleClass("hidden",!this.checked),$("#setDefaultExpireDate").toggleClass("hidden",!(this.checked&&$("#shareapiDefaultExpireDate")[0].checked))})),$("#mail_smtpauth").change((function(){this.checked?$("#mail_credentials").removeClass("hidden"):$("#mail_credentials").addClass("hidden")})),$("#mail_smtpmode").change((function(){"smtp"!==$(this).val()?($("#setting_smtpauth").addClass("hidden"),$("#setting_smtphost").addClass("hidden"),$("#mail_smtpsecure_label").addClass("hidden"),$("#mail_smtpsecure").addClass("hidden"),$("#mail_credentials").addClass("hidden"),$("#mail_sendmailmode_label, #mail_sendmailmode").removeClass("hidden")):($("#setting_smtpauth").removeClass("hidden"),$("#setting_smtphost").removeClass("hidden"),$("#mail_smtpsecure_label").removeClass("hidden"),$("#mail_smtpsecure").removeClass("hidden"),$("#mail_smtpauth").is(":checked")&&$("#mail_credentials").removeClass("hidden"),$("#mail_sendmailmode_label, #mail_sendmailmode").addClass("hidden"))})),$("#mail_general_settings_form").change((function e(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(e):(OC.msg.startSaving("#mail_settings_msg"),$.ajax({url:OC.generateUrl("/settings/admin/mailsettings"),type:"POST",data:$("#mail_general_settings_form").serialize(),success:function(){OC.msg.finishedSuccess("#mail_settings_msg",t("settings","Saved"))},error:function(e){OC.msg.finishedError("#mail_settings_msg",e.responseJSON)}}))})),$("#mail_credentials_settings_submit").click((function e(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(e):(OC.msg.startSaving("#mail_settings_msg"),$.ajax({url:OC.generateUrl("/settings/admin/mailsettings/credentials"),type:"POST",data:$("#mail_credentials_settings").serialize(),success:function(){OC.msg.finishedSuccess("#mail_settings_msg",t("settings","Saved"))},error:function(e){OC.msg.finishedError("#mail_settings_msg",e.responseJSON)}}))})),$("#mail_smtppassword").click((function(){"text"===e.type&&"********"===e.value&&(e.type="password",e.value="")})),$("#sendtestemail").click((function(e){e.preventDefault(),OC.msg.startAction("#sendtestmail_msg",t("settings","Sending…")),$.ajax({url:OC.generateUrl("/settings/admin/mailtest"),type:"POST",success:function(){OC.msg.finishedSuccess("#sendtestmail_msg",t("settings","Email sent"))},error:function(e){OC.msg.finishedError("#sendtestmail_msg",e.responseJSON)}})})),$("#allowGroupSharing").change((function(){$("#allowGroupSharing").toggleClass("hidden",!this.checked)})),$("#shareapiExcludeGroups").change((function(){$("#selectExcludedGroups").toggleClass("hidden",!this.checked)})),null!==document.getElementById("security-warning")&&$.when(OC.SetupChecks.checkWebDAV(),OC.SetupChecks.checkWellKnownUrl("GET","/.well-known/webfinger",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown"),[200,404],!0),OC.SetupChecks.checkWellKnownUrl("GET","/.well-known/nodeinfo",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown"),[200,404],!0),OC.SetupChecks.checkWellKnownUrl("PROPFIND","/.well-known/caldav",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkWellKnownUrl("PROPFIND","/.well-known/carddav",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkProviderUrl(OC.getRootPath()+"/ocm-provider/",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkProviderUrl(OC.getRootPath()+"/ocs-provider/",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkSetup(),OC.SetupChecks.checkGeneric(),OC.SetupChecks.checkWOFF2Loading(OC.filePath("core","","fonts/NotoSans-Regular-latin.woff2"),OC.theme.docPlaceholderUrl),OC.SetupChecks.checkDataProtected()).then((function(e,s,t,i,a,n,l,r,c,d,o){var h=[].concat(e,s,t,i,a,n,l,r,c,d,o),u=$("#postsetupchecks");$("#security-warning-state-loading").addClass("hidden");for(var g=!1,m=u.find(".errors"),p=u.find(".warnings"),C=u.find(".info"),f=0;f"+h[f].msg+"");break;case OC.SetupChecks.MESSAGE_TYPE_WARNING:p.append("
  • "+h[f].msg+"
  • ");break;case OC.SetupChecks.MESSAGE_TYPE_ERROR:default:m.append("
  • "+h[f].msg+"
  • ")}m.find("li").length>0&&(m.removeClass("hidden"),g=!0),p.find("li").length>0&&(p.removeClass("hidden"),g=!0),C.find("li").length>0&&(C.removeClass("hidden"),g=!0),g?($("#postsetupchecks-hint").removeClass("hidden"),m.find("li").length>0?$("#security-warning-state-failure").removeClass("hidden"):$("#security-warning-state-warning").removeClass("hidden")):0===$("#security-warning").children("ul").children().length?$("#security-warning-state-ok").removeClass("hidden"):$("#security-warning-state-failure").removeClass("hidden")})),$("#shareAPI").removeClass("loading")}))}})[39583](); -//# sourceMappingURL=settings-legacy-admin.js.map?v=0f765f80ba1c1f32f578 \ No newline at end of file +({39583:function(){var e=this;window.addEventListener("DOMContentLoaded",(function(){$("#shareGroupMembersExcludeGroups,#linksExcludedGroups,#passwordsExcludedGroups").each((function(e,s){OC.Settings.setupGroupsSelect($(s)),$(s).change((function(e){var s=e.val||[];s=JSON.stringify(s),OCP.AppConfig.setValue("core",$(this).attr("name"),s)}))})),$("#loglevel").change((function(){$.post(OC.generateUrl("/settings/admin/log/level"),{level:$(this).val()},(function(){OC.Log.reload()}))})),$("#shareAPIEnabled").change((function(){$("#shareAPI p:not(#enable)").toggleClass("hidden",!this.checked)})),$("#shareapiExpireAfterNDays").on("input",(function(){this.value=this.value.replace(/\D/g,"")})),$("#shareAPI input:not(.noJSAutoUpdate)").change((function(){var e=$(this).val();"checkbox"===$(this).attr("type")&&(e=this.checked?"yes":"no"),OCP.AppConfig.setValue("core",$(this).attr("name"),e)})),$("#shareapiDefaultExpireDate").change((function(){$("#setDefaultExpireDate").toggleClass("hidden",!this.checked)})),$("#shareapiDefaultInternalExpireDate").change((function(){$("#setDefaultInternalExpireDate").toggleClass("hidden",!this.checked)})),$("#shareapiDefaultRemoteExpireDate").change((function(){$("#setDefaultRemoteExpireDate").toggleClass("hidden",!this.checked)})),$("#enableLinkPasswordByDefault").change((function(){this.checked?($("#enforceLinkPassword").removeAttr("disabled"),$("#passwordsExcludedGroups").removeAttr("disabled")):($("#enforceLinkPassword").attr("disabled",""),$("#passwordsExcludedGroups").attr("disabled",""),$("#enforceLinkPassword").removeAttr("checked").trigger("change"))})),$("#enforceLinkPassword").change((function(){$("#selectPasswordsExcludedGroups").toggleClass("hidden",!this.checked)})),$("#publicShareDisclaimer").change((function(){$("#publicShareDisclaimerText").toggleClass("hidden",!this.checked),this.checked||s("")})),$("#shareApiDefaultPermissionsSection input").change((function(e){var s=$("#shareApiDefaultPermissions"),t=$(e.target),i=s.val();return t.is(":checked")?i|=t.val():i&=~t.val(),i|=OC.PERMISSION_READ,s.val(i).change(),e.preventDefault(),!1}));var s=_.debounce((function(e){var s={success:function(){OC.msg.finishedSuccess("#publicShareDisclaimerStatus",t("settings","Saved"))},error:function(){OC.msg.finishedError("#publicShareDisclaimerStatus",t("settings","Not saved"))}};OC.msg.startSaving("#publicShareDisclaimerStatus"),_.isString(e)&&""!==e?OCP.AppConfig.setValue("core","shareapi_public_link_disclaimertext",e,s):($("#publicShareDisclaimerText").val(""),OCP.AppConfig.deleteKey("core","shareapi_public_link_disclaimertext",s))}),500);$("#publicShareDisclaimerText").on("change, keyup",(function(){s(this.value)})),$("#shareapi_allow_share_dialog_user_enumeration").on("change",(function(){$("#shareapi_restrict_user_enumeration_to_group_setting").toggleClass("hidden",!this.checked),$("#shareapi_restrict_user_enumeration_to_phone_setting").toggleClass("hidden",!this.checked),$("#shareapi_restrict_user_enumeration_combinewarning_setting").toggleClass("hidden",!this.checked)})),$("#allowLinks").change((function(){$("#publicLinkSettings").toggleClass("hidden",!this.checked),$("#setDefaultExpireDate").toggleClass("hidden",!(this.checked&&$("#shareapiDefaultExpireDate")[0].checked))})),$("#mail_smtpauth").change((function(){this.checked?$("#mail_credentials").removeClass("hidden"):$("#mail_credentials").addClass("hidden")})),$("#mail_smtpmode").change((function(){"smtp"!==$(this).val()?($("#setting_smtpauth").addClass("hidden"),$("#setting_smtphost").addClass("hidden"),$("#mail_smtpsecure_label").addClass("hidden"),$("#mail_smtpsecure").addClass("hidden"),$("#mail_credentials").addClass("hidden"),$("#mail_sendmailmode_label, #mail_sendmailmode").removeClass("hidden")):($("#setting_smtpauth").removeClass("hidden"),$("#setting_smtphost").removeClass("hidden"),$("#mail_smtpsecure_label").removeClass("hidden"),$("#mail_smtpsecure").removeClass("hidden"),$("#mail_smtpauth").is(":checked")&&$("#mail_credentials").removeClass("hidden"),$("#mail_sendmailmode_label, #mail_sendmailmode").addClass("hidden"))})),$("#mail_general_settings_form").change((function e(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(e):(OC.msg.startSaving("#mail_settings_msg"),$.ajax({url:OC.generateUrl("/settings/admin/mailsettings"),type:"POST",data:$("#mail_general_settings_form").serialize(),success:function(){OC.msg.finishedSuccess("#mail_settings_msg",t("settings","Saved"))},error:function(e){OC.msg.finishedError("#mail_settings_msg",e.responseJSON)}}))})),$("#mail_credentials_settings_submit").click((function e(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(e):(OC.msg.startSaving("#mail_settings_msg"),$.ajax({url:OC.generateUrl("/settings/admin/mailsettings/credentials"),type:"POST",data:$("#mail_credentials_settings").serialize(),success:function(){OC.msg.finishedSuccess("#mail_settings_msg",t("settings","Saved"))},error:function(e){OC.msg.finishedError("#mail_settings_msg",e.responseJSON)}}))})),$("#mail_smtppassword").click((function(){"text"===e.type&&"********"===e.value&&(e.type="password",e.value="")})),$("#sendtestemail").click((function(e){e.preventDefault(),OC.msg.startAction("#sendtestmail_msg",t("settings","Sending…")),$.ajax({url:OC.generateUrl("/settings/admin/mailtest"),type:"POST",success:function(){OC.msg.finishedSuccess("#sendtestmail_msg",t("settings","Email sent"))},error:function(e){OC.msg.finishedError("#sendtestmail_msg",e.responseJSON)}})})),$("#allowGroupSharing").change((function(){$("#allowGroupSharing").toggleClass("hidden",!this.checked)})),$("#shareapiExcludeGroups").change((function(){$("#selectExcludedGroups").toggleClass("hidden",!this.checked)})),$("#onlyShareWithGroupMembers").change((function(){$("#selectShareWithGroupMembersExcludeGroups").toggleClass("hidden",!this.checked)})),null!==document.getElementById("security-warning")&&$.when(OC.SetupChecks.checkWebDAV(),OC.SetupChecks.checkWellKnownUrl("GET","/.well-known/webfinger",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown"),[200,404],!0),OC.SetupChecks.checkWellKnownUrl("GET","/.well-known/nodeinfo",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown"),[200,404],!0),OC.SetupChecks.checkWellKnownUrl("PROPFIND","/.well-known/caldav",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkWellKnownUrl("PROPFIND","/.well-known/carddav",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkProviderUrl(OC.getRootPath()+"/ocm-provider/",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkProviderUrl(OC.getRootPath()+"/ocs-provider/",OC.theme.docPlaceholderUrl,!0===$("#postsetupchecks").data("check-wellknown")),OC.SetupChecks.checkSetup(),OC.SetupChecks.checkGeneric(),OC.SetupChecks.checkWOFF2Loading(OC.filePath("core","","fonts/NotoSans-Regular-latin.woff2"),OC.theme.docPlaceholderUrl),OC.SetupChecks.checkDataProtected()).then((function(e,s,t,i,a,n,l,r,c,o,d){var h=[].concat(e,s,t,i,a,n,l,r,c,o,d),u=$("#postsetupchecks");$("#security-warning-state-loading").addClass("hidden");for(var g=!1,m=u.find(".errors"),p=u.find(".warnings"),C=u.find(".info"),f=0;f"+h[f].msg+"");break;case OC.SetupChecks.MESSAGE_TYPE_WARNING:p.append("
  • "+h[f].msg+"
  • ");break;case OC.SetupChecks.MESSAGE_TYPE_ERROR:default:m.append("
  • "+h[f].msg+"
  • ")}m.find("li").length>0&&(m.removeClass("hidden"),g=!0),p.find("li").length>0&&(p.removeClass("hidden"),g=!0),C.find("li").length>0&&(C.removeClass("hidden"),g=!0),g?($("#postsetupchecks-hint").removeClass("hidden"),m.find("li").length>0?$("#security-warning-state-failure").removeClass("hidden"):$("#security-warning-state-warning").removeClass("hidden")):0===$("#security-warning").children("ul").children().length?$("#security-warning-state-ok").removeClass("hidden"):$("#security-warning-state-failure").removeClass("hidden")})),$("#shareAPI").removeClass("loading")}))}})[39583](); +//# sourceMappingURL=settings-legacy-admin.js.map?v=9206ff5ad6c462cb7c21 \ No newline at end of file diff --git a/dist/settings-legacy-admin.js.map b/dist/settings-legacy-admin.js.map index 7cb70a3dbcf21..75829efd1f6ba 100644 --- a/dist/settings-legacy-admin.js.map +++ b/dist/settings-legacy-admin.js.map @@ -1 +1 @@ -{"version":3,"file":"settings-legacy-admin.js?v=0f765f80ba1c1f32f578","mappings":"8BAAAA,OAAOC,iBAAiB,oBAAoB,WAC3CC,EAAE,iDAAiDC,MAAK,SAASC,EAAOC,GACvEC,GAAGC,SAASC,kBAAkBN,EAAEG,IAChCH,EAAEG,GAASI,QAAO,SAASC,GAC1B,IAAIC,EAASD,EAAGE,KAAO,GACvBD,EAASE,KAAKC,UAAUH,GACxBI,IAAIC,UAAUC,SAAS,OAAQf,EAAEgB,MAAMC,KAAK,QAASR,EACtD,GACD,IAEAT,EAAE,aAAaO,QAAO,WACrBP,EAAEkB,KAAKd,GAAGe,YAAY,6BAA8B,CAAEC,MAAOpB,EAAEgB,MAAMN,QAAS,WAC7EN,GAAGiB,IAAIC,QACR,GACD,IAEAtB,EAAE,oBAAoBO,QAAO,WAC5BP,EAAE,4BAA4BuB,YAAY,UAAWP,KAAKQ,QAC3D,IAEAxB,EAAE,6BAA6ByB,GAAG,SAAS,WAC1CT,KAAKU,MAAQV,KAAKU,MAAMC,QAAQ,MAAO,GACxC,IAEA3B,EAAE,wCAAwCO,QAAO,WAChD,IAAImB,EAAQ1B,EAAEgB,MAAMN,MACS,aAAzBV,EAAEgB,MAAMC,KAAK,UAEfS,EADGV,KAAKQ,QACA,MAEA,MAGVX,IAAIC,UAAUC,SAAS,OAAQf,EAAEgB,MAAMC,KAAK,QAASS,EACtD,IAEA1B,EAAE,8BAA8BO,QAAO,WACtCP,EAAE,yBAAyBuB,YAAY,UAAWP,KAAKQ,QACxD,IAEAxB,EAAE,sCAAsCO,QAAO,WAC9CP,EAAE,iCAAiCuB,YAAY,UAAWP,KAAKQ,QAChE,IAEAxB,EAAE,oCAAoCO,QAAO,WAC5CP,EAA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P,EAASO,GAAG5C,MACpB,KAAKrD,GAAGkE,YAAYiC,kBACnBH,EAAQI,OAAO,OAASV,EAASO,GAAG5D,IAAM,SAC1C,MACD,KAAKrC,GAAGkE,YAAYmC,qBACnBN,EAAYK,OAAO,OAASV,EAASO,GAAG5D,IAAM,SAC9C,MACD,KAAKrC,GAAGkE,YAAYoC,mBACpB,QACCT,EAAUO,OAAO,OAASV,EAASO,GAAG5D,IAAM,SAI1CwD,EAAUC,KAAK,MAAMI,OAAS,IACjCL,EAAUhD,YAAY,UACtB+C,GAAc,GAEXG,EAAYD,KAAK,MAAMI,OAAS,IACnCH,EAAYlD,YAAY,UACxB+C,GAAc,GAEXI,EAAQF,KAAK,MAAMI,OAAS,IAC/BF,EAAQnD,YAAY,UACpB+C,GAAc,GAGXA,GACHhG,EAAE,yBAAyBiD,YAAY,UACnCgD,EAAUC,KAAK,MAAMI,OAAS,EACjCtG,EAAE,mCAAmCiD,YAAY,UAEjDjD,EAAE,mCAAmCiD,YAAY,WAIO,IADjCjD,EAAE,qBACN2G,SAAS,MAAMA,WAAWL,OAC7CtG,EAAE,8BAA8BiD,YAAY,UAE5CjD,EAAE,mCAAmCiD,YAAY,SAGpD,IAODjD,EAAE,aAAaiD,YAAY,UAC5B,G,IC7SoB","sources":["webpack:///nextcloud/apps/settings/src/admin.js","webpack:///nextcloud/webpack/startup"],"sourcesContent":["window.addEventListener('DOMContentLoaded', () => {\n\t$('#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) {\n\t\tOC.Settings.setupGroupsSelect($(element))\n\t\t$(element).change(function(ev) {\n\t\t\tlet groups = ev.val || []\n\t\t\tgroups = JSON.stringify(groups)\n\t\t\tOCP.AppConfig.setValue('core', $(this).attr('name'), groups)\n\t\t})\n\t})\n\n\t$('#loglevel').change(function() {\n\t\t$.post(OC.generateUrl('/settings/admin/log/level'), { level: $(this).val() }, () => {\n\t\t\tOC.Log.reload()\n\t\t})\n\t})\n\n\t$('#shareAPIEnabled').change(function() {\n\t\t$('#shareAPI p:not(#enable)').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiExpireAfterNDays').on('input', function() {\n\t\tthis.value = this.value.replace(/\\D/g, '')\n\t})\n\n\t$('#shareAPI input:not(.noJSAutoUpdate)').change(function() {\n\t\tlet value = $(this).val()\n\t\tif ($(this).attr('type') === 'checkbox') {\n\t\t\tif (this.checked) {\n\t\t\t\tvalue = 'yes'\n\t\t\t} else {\n\t\t\t\tvalue = 'no'\n\t\t\t}\n\t\t}\n\t\tOCP.AppConfig.setValue('core', $(this).attr('name'), value)\n\t})\n\n\t$('#shareapiDefaultExpireDate').change(function() {\n\t\t$('#setDefaultExpireDate').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiDefaultInternalExpireDate').change(function() {\n\t\t$('#setDefaultInternalExpireDate').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiDefaultRemoteExpireDate').change(function() {\n\t\t$('#setDefaultRemoteExpireDate').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#enableLinkPasswordByDefault').change(function() {\n\t\tif (this.checked) {\n\t\t\t$('#enforceLinkPassword').removeAttr('disabled')\n\t\t\t$('#passwordsExcludedGroups').removeAttr('disabled')\n\t\t} else {\n\t\t\t$('#enforceLinkPassword').attr('disabled', '')\n\t\t\t$('#passwordsExcludedGroups').attr('disabled', '')\n\n\t\t\t// Uncheck \"Enforce password protection\" when \"Always asks for a\n\t\t\t// password\" is unchecked; the change event needs to be explicitly\n\t\t\t// triggered so it behaves like a change done by the user.\n\t\t\t$('#enforceLinkPassword').removeAttr('checked').trigger('change')\n\t\t}\n\t})\n\n\t$('#enforceLinkPassword').change(function() {\n\t\t$('#selectPasswordsExcludedGroups').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#publicShareDisclaimer').change(function() {\n\t\t$('#publicShareDisclaimerText').toggleClass('hidden', !this.checked)\n\t\tif (!this.checked) {\n\t\t\tsavePublicShareDisclaimerText('')\n\t\t}\n\t})\n\n\t$('#shareApiDefaultPermissionsSection input').change(function(ev) {\n\t\tconst $el = $('#shareApiDefaultPermissions')\n\t\tconst $target = $(ev.target)\n\n\t\tlet value = $el.val()\n\t\tif ($target.is(':checked')) {\n\t\t\tvalue = value | $target.val()\n\t\t} else {\n\t\t\tvalue = value & ~$target.val()\n\t\t}\n\n\t\t// always set read permission\n\t\tvalue |= OC.PERMISSION_READ\n\n\t\t// this will trigger the field's change event and will save it\n\t\t$el.val(value).change()\n\n\t\tev.preventDefault()\n\n\t\treturn false\n\t})\n\n\tconst savePublicShareDisclaimerText = _.debounce(function(value) {\n\t\tconst options = {\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#publicShareDisclaimerStatus', t('settings', 'Saved'))\n\t\t\t},\n\t\t\terror: () => {\n\t\t\t\tOC.msg.finishedError('#publicShareDisclaimerStatus', t('settings', 'Not saved'))\n\t\t\t},\n\t\t}\n\n\t\tOC.msg.startSaving('#publicShareDisclaimerStatus')\n\t\tif (_.isString(value) && value !== '') {\n\t\t\tOCP.AppConfig.setValue('core', 'shareapi_public_link_disclaimertext', value, options)\n\t\t} else {\n\t\t\t$('#publicShareDisclaimerText').val('')\n\t\t\tOCP.AppConfig.deleteKey('core', 'shareapi_public_link_disclaimertext', options)\n\t\t}\n\t}, 500)\n\n\t$('#publicShareDisclaimerText').on('change, keyup', function() {\n\t\tsavePublicShareDisclaimerText(this.value)\n\t})\n\n\t$('#shareapi_allow_share_dialog_user_enumeration').on('change', function() {\n\t\t$('#shareapi_restrict_user_enumeration_to_group_setting').toggleClass('hidden', !this.checked)\n\t\t$('#shareapi_restrict_user_enumeration_to_phone_setting').toggleClass('hidden', !this.checked)\n\t\t$('#shareapi_restrict_user_enumeration_combinewarning_setting').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#allowLinks').change(function() {\n\t\t$('#publicLinkSettings').toggleClass('hidden', !this.checked)\n\t\t$('#setDefaultExpireDate').toggleClass('hidden', !(this.checked && $('#shareapiDefaultExpireDate')[0].checked))\n\t})\n\n\t$('#mail_smtpauth').change(function() {\n\t\tif (!this.checked) {\n\t\t\t$('#mail_credentials').addClass('hidden')\n\t\t} else {\n\t\t\t$('#mail_credentials').removeClass('hidden')\n\t\t}\n\t})\n\n\t$('#mail_smtpmode').change(function() {\n\t\tif ($(this).val() !== 'smtp') {\n\t\t\t$('#setting_smtpauth').addClass('hidden')\n\t\t\t$('#setting_smtphost').addClass('hidden')\n\t\t\t$('#mail_smtpsecure_label').addClass('hidden')\n\t\t\t$('#mail_smtpsecure').addClass('hidden')\n\t\t\t$('#mail_credentials').addClass('hidden')\n\t\t\t$('#mail_sendmailmode_label, #mail_sendmailmode').removeClass('hidden')\n\t\t} else {\n\t\t\t$('#setting_smtpauth').removeClass('hidden')\n\t\t\t$('#setting_smtphost').removeClass('hidden')\n\t\t\t$('#mail_smtpsecure_label').removeClass('hidden')\n\t\t\t$('#mail_smtpsecure').removeClass('hidden')\n\t\t\tif ($('#mail_smtpauth').is(':checked')) {\n\t\t\t\t$('#mail_credentials').removeClass('hidden')\n\t\t\t}\n\t\t\t$('#mail_sendmailmode_label, #mail_sendmailmode').addClass('hidden')\n\t\t}\n\t})\n\n\tconst changeEmailSettings = function() {\n\t\tif (OC.PasswordConfirmation.requiresPasswordConfirmation()) {\n\t\t\tOC.PasswordConfirmation.requirePasswordConfirmation(changeEmailSettings)\n\t\t\treturn\n\t\t}\n\n\t\tOC.msg.startSaving('#mail_settings_msg')\n\t\t$.ajax({\n\t\t\turl: OC.generateUrl('/settings/admin/mailsettings'),\n\t\t\ttype: 'POST',\n\t\t\tdata: $('#mail_general_settings_form').serialize(),\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'))\n\t\t\t},\n\t\t\terror: (xhr) => {\n\t\t\t\tOC.msg.finishedError('#mail_settings_msg', xhr.responseJSON)\n\t\t\t},\n\t\t})\n\t}\n\n\tconst toggleEmailCredentials = function() {\n\t\tif (OC.PasswordConfirmation.requiresPasswordConfirmation()) {\n\t\t\tOC.PasswordConfirmation.requirePasswordConfirmation(toggleEmailCredentials)\n\t\t\treturn\n\t\t}\n\n\t\tOC.msg.startSaving('#mail_settings_msg')\n\t\t$.ajax({\n\t\t\turl: OC.generateUrl('/settings/admin/mailsettings/credentials'),\n\t\t\ttype: 'POST',\n\t\t\tdata: $('#mail_credentials_settings').serialize(),\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'))\n\t\t\t},\n\t\t\terror: (xhr) => {\n\t\t\t\tOC.msg.finishedError('#mail_settings_msg', xhr.responseJSON)\n\t\t\t},\n\t\t})\n\t}\n\n\t$('#mail_general_settings_form').change(changeEmailSettings)\n\t$('#mail_credentials_settings_submit').click(toggleEmailCredentials)\n\t$('#mail_smtppassword').click(() => {\n\t\tif (this.type === 'text' && this.value === '********') {\n\t\t\tthis.type = 'password'\n\t\t\tthis.value = ''\n\t\t}\n\t})\n\n\t$('#sendtestemail').click((event) => {\n\t\tevent.preventDefault()\n\t\tOC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending…'))\n\n\t\t$.ajax({\n\t\t\turl: OC.generateUrl('/settings/admin/mailtest'),\n\t\t\ttype: 'POST',\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent'))\n\t\t\t},\n\t\t\terror: (xhr) => {\n\t\t\t\tOC.msg.finishedError('#sendtestmail_msg', xhr.responseJSON)\n\t\t\t},\n\t\t})\n\t})\n\n\t$('#allowGroupSharing').change(function() {\n\t\t$('#allowGroupSharing').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiExcludeGroups').change(function() {\n\t\t$('#selectExcludedGroups').toggleClass('hidden', !this.checked)\n\t})\n\n\tconst setupChecks = () => {\n\t\t// run setup checks then gather error messages\n\t\t$.when(\n\t\t\tOC.SetupChecks.checkWebDAV(),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('GET', '/.well-known/webfinger', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true, [200, 404], true),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('GET', '/.well-known/nodeinfo', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true, [200, 404], true),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/carddav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocm-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocs-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkSetup(),\n\t\t\tOC.SetupChecks.checkGeneric(),\n\t\t\tOC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), OC.theme.docPlaceholderUrl),\n\t\t\tOC.SetupChecks.checkDataProtected(),\n\t\t).then((check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11) => {\n\t\t\tconst messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11)\n\t\t\tconst $el = $('#postsetupchecks')\n\t\t\t$('#security-warning-state-loading').addClass('hidden')\n\n\t\t\tlet hasMessages = false\n\t\t\tconst $errorsEl = $el.find('.errors')\n\t\t\tconst $warningsEl = $el.find('.warnings')\n\t\t\tconst $infoEl = $el.find('.info')\n\n\t\t\tfor (let i = 0; i < messages.length; i++) {\n\t\t\t\tswitch (messages[i].type) {\n\t\t\t\tcase OC.SetupChecks.MESSAGE_TYPE_INFO:\n\t\t\t\t\t$infoEl.append('
  • ' + messages[i].msg + '
  • ')\n\t\t\t\t\tbreak\n\t\t\t\tcase OC.SetupChecks.MESSAGE_TYPE_WARNING:\n\t\t\t\t\t$warningsEl.append('
  • ' + messages[i].msg + '
  • ')\n\t\t\t\t\tbreak\n\t\t\t\tcase OC.SetupChecks.MESSAGE_TYPE_ERROR:\n\t\t\t\tdefault:\n\t\t\t\t\t$errorsEl.append('
  • ' + messages[i].msg + '
  • ')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($errorsEl.find('li').length > 0) {\n\t\t\t\t$errorsEl.removeClass('hidden')\n\t\t\t\thasMessages = true\n\t\t\t}\n\t\t\tif ($warningsEl.find('li').length > 0) {\n\t\t\t\t$warningsEl.removeClass('hidden')\n\t\t\t\thasMessages = true\n\t\t\t}\n\t\t\tif ($infoEl.find('li').length > 0) {\n\t\t\t\t$infoEl.removeClass('hidden')\n\t\t\t\thasMessages = true\n\t\t\t}\n\n\t\t\tif (hasMessages) {\n\t\t\t\t$('#postsetupchecks-hint').removeClass('hidden')\n\t\t\t\tif ($errorsEl.find('li').length > 0) {\n\t\t\t\t\t$('#security-warning-state-failure').removeClass('hidden')\n\t\t\t\t} else {\n\t\t\t\t\t$('#security-warning-state-warning').removeClass('hidden')\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst securityWarning = $('#security-warning')\n\t\t\t\tif (securityWarning.children('ul').children().length === 0) {\n\t\t\t\t\t$('#security-warning-state-ok').removeClass('hidden')\n\t\t\t\t} else {\n\t\t\t\t\t$('#security-warning-state-failure').removeClass('hidden')\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tif (document.getElementById('security-warning') !== null) {\n\t\tsetupChecks()\n\t}\n\n\t$('#shareAPI').removeClass('loading')\n})\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = {};\n__webpack_modules__[39583]();\n"],"names":["window","addEventListener","$","each","index","element","OC","Settings","setupGroupsSelect","change","ev","groups","val","JSON","stringify","OCP","AppConfig","setValue","this","attr","post","generateUrl","level","Log","reload","toggleClass","checked","on","value","replace","removeAttr","trigger","savePublicShareDisclaimerText","$el","$target","target","is","PERMISSION_READ","preventDefault","_","debounce","options","success","msg","finishedSuccess","t","error","finishedError","startSaving","isString","deleteKey","removeClass","addClass","changeEmailSettings","PasswordConfirmation","requiresPasswordConfirmation","requirePasswordConfirmation","ajax","url","type","data","serialize","xhr","responseJSON","click","toggleEmailCredentials","_this","event","startAction","document","getElementById","when","SetupChecks","checkWebDAV","checkWellKnownUrl","theme","docPlaceholderUrl","checkProviderUrl","getRootPath","checkSetup","checkGeneric","checkWOFF2Loading","filePath","checkDataProtected","then","check1","check2","check3","check4","check5","check6","check7","check8","check9","check10","check11","messages","concat","hasMessages","$errorsEl","find","$warningsEl","$infoEl","i","length","MESSAGE_TYPE_INFO","append","MESSAGE_TYPE_WARNING","MESSAGE_TYPE_ERROR","children"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"settings-legacy-admin.js?v=9206ff5ad6c462cb7c21","mappings":"8BAAAA,OAAOC,iBAAiB,oBAAoB,WAC3CC,EAAE,iFAAiFC,MAAK,SAASC,EAAOC,GACvGC,GAAGC,SAASC,kBAAkBN,EAAEG,IAChCH,EAAEG,GAASI,QAAO,SAASC,GAC1B,IAAIC,EAASD,EAAGE,KAAO,GACvBD,EAASE,KAAKC,UAAUH,GACxBI,IAAIC,UAAUC,SAAS,OAAQf,EAAEgB,MAAMC,KAAK,QAASR,EACtD,GACD,IAEAT,EAAE,aAAaO,QAAO,WACrBP,EAAEkB,KAAKd,GAAGe,YAAY,6BAA8B,CAAEC,MAAOpB,EAAEgB,MAAMN,QAAS,WAC7EN,GAAGiB,IAAIC,QACR,GACD,IAEAtB,EAAE,oBAAoBO,QAAO,WAC5BP,EAAE,4BAA4BuB,YAAY,UAAWP,KAAKQ,QAC3D,IAEAxB,EAAE,6BAA6ByB,GAAG,SAAS,WAC1CT,KAAKU,MAAQV,KAA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CjD,EAAE,mCAAmCiD,YAAY,SAGpD,IAODjD,EAAE,aAAaiD,YAAY,UAC5B,G,ICjToB","sources":["webpack:///nextcloud/apps/settings/src/admin.js","webpack:///nextcloud/webpack/startup"],"sourcesContent":["window.addEventListener('DOMContentLoaded', () => {\n\t$('#shareGroupMembersExcludeGroups,#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) {\n\t\tOC.Settings.setupGroupsSelect($(element))\n\t\t$(element).change(function(ev) {\n\t\t\tlet groups = ev.val || []\n\t\t\tgroups = JSON.stringify(groups)\n\t\t\tOCP.AppConfig.setValue('core', $(this).attr('name'), groups)\n\t\t})\n\t})\n\n\t$('#loglevel').change(function() {\n\t\t$.post(OC.generateUrl('/settings/admin/log/level'), { level: $(this).val() }, () => {\n\t\t\tOC.Log.reload()\n\t\t})\n\t})\n\n\t$('#shareAPIEnabled').change(function() {\n\t\t$('#shareAPI p:not(#enable)').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiExpireAfterNDays').on('input', function() {\n\t\tthis.value = this.value.replace(/\\D/g, '')\n\t})\n\n\t$('#shareAPI input:not(.noJSAutoUpdate)').change(function() {\n\t\tlet value = $(this).val()\n\t\tif ($(this).attr('type') === 'checkbox') {\n\t\t\tif (this.checked) {\n\t\t\t\tvalue = 'yes'\n\t\t\t} else {\n\t\t\t\tvalue = 'no'\n\t\t\t}\n\t\t}\n\t\tOCP.AppConfig.setValue('core', $(this).attr('name'), value)\n\t})\n\n\t$('#shareapiDefaultExpireDate').change(function() {\n\t\t$('#setDefaultExpireDate').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiDefaultInternalExpireDate').change(function() {\n\t\t$('#setDefaultInternalExpireDate').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiDefaultRemoteExpireDate').change(function() {\n\t\t$('#setDefaultRemoteExpireDate').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#enableLinkPasswordByDefault').change(function() {\n\t\tif (this.checked) {\n\t\t\t$('#enforceLinkPassword').removeAttr('disabled')\n\t\t\t$('#passwordsExcludedGroups').removeAttr('disabled')\n\t\t} else {\n\t\t\t$('#enforceLinkPassword').attr('disabled', '')\n\t\t\t$('#passwordsExcludedGroups').attr('disabled', '')\n\n\t\t\t// Uncheck \"Enforce password protection\" when \"Always asks for a\n\t\t\t// password\" is unchecked; the change event needs to be explicitly\n\t\t\t// triggered so it behaves like a change done by the user.\n\t\t\t$('#enforceLinkPassword').removeAttr('checked').trigger('change')\n\t\t}\n\t})\n\n\t$('#enforceLinkPassword').change(function() {\n\t\t$('#selectPasswordsExcludedGroups').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#publicShareDisclaimer').change(function() {\n\t\t$('#publicShareDisclaimerText').toggleClass('hidden', !this.checked)\n\t\tif (!this.checked) {\n\t\t\tsavePublicShareDisclaimerText('')\n\t\t}\n\t})\n\n\t$('#shareApiDefaultPermissionsSection input').change(function(ev) {\n\t\tconst $el = $('#shareApiDefaultPermissions')\n\t\tconst $target = $(ev.target)\n\n\t\tlet value = $el.val()\n\t\tif ($target.is(':checked')) {\n\t\t\tvalue = value | $target.val()\n\t\t} else {\n\t\t\tvalue = value & ~$target.val()\n\t\t}\n\n\t\t// always set read permission\n\t\tvalue |= OC.PERMISSION_READ\n\n\t\t// this will trigger the field's change event and will save it\n\t\t$el.val(value).change()\n\n\t\tev.preventDefault()\n\n\t\treturn false\n\t})\n\n\tconst savePublicShareDisclaimerText = _.debounce(function(value) {\n\t\tconst options = {\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#publicShareDisclaimerStatus', t('settings', 'Saved'))\n\t\t\t},\n\t\t\terror: () => {\n\t\t\t\tOC.msg.finishedError('#publicShareDisclaimerStatus', t('settings', 'Not saved'))\n\t\t\t},\n\t\t}\n\n\t\tOC.msg.startSaving('#publicShareDisclaimerStatus')\n\t\tif (_.isString(value) && value !== '') {\n\t\t\tOCP.AppConfig.setValue('core', 'shareapi_public_link_disclaimertext', value, options)\n\t\t} else {\n\t\t\t$('#publicShareDisclaimerText').val('')\n\t\t\tOCP.AppConfig.deleteKey('core', 'shareapi_public_link_disclaimertext', options)\n\t\t}\n\t}, 500)\n\n\t$('#publicShareDisclaimerText').on('change, keyup', function() {\n\t\tsavePublicShareDisclaimerText(this.value)\n\t})\n\n\t$('#shareapi_allow_share_dialog_user_enumeration').on('change', function() {\n\t\t$('#shareapi_restrict_user_enumeration_to_group_setting').toggleClass('hidden', !this.checked)\n\t\t$('#shareapi_restrict_user_enumeration_to_phone_setting').toggleClass('hidden', !this.checked)\n\t\t$('#shareapi_restrict_user_enumeration_combinewarning_setting').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#allowLinks').change(function() {\n\t\t$('#publicLinkSettings').toggleClass('hidden', !this.checked)\n\t\t$('#setDefaultExpireDate').toggleClass('hidden', !(this.checked && $('#shareapiDefaultExpireDate')[0].checked))\n\t})\n\n\t$('#mail_smtpauth').change(function() {\n\t\tif (!this.checked) {\n\t\t\t$('#mail_credentials').addClass('hidden')\n\t\t} else {\n\t\t\t$('#mail_credentials').removeClass('hidden')\n\t\t}\n\t})\n\n\t$('#mail_smtpmode').change(function() {\n\t\tif ($(this).val() !== 'smtp') {\n\t\t\t$('#setting_smtpauth').addClass('hidden')\n\t\t\t$('#setting_smtphost').addClass('hidden')\n\t\t\t$('#mail_smtpsecure_label').addClass('hidden')\n\t\t\t$('#mail_smtpsecure').addClass('hidden')\n\t\t\t$('#mail_credentials').addClass('hidden')\n\t\t\t$('#mail_sendmailmode_label, #mail_sendmailmode').removeClass('hidden')\n\t\t} else {\n\t\t\t$('#setting_smtpauth').removeClass('hidden')\n\t\t\t$('#setting_smtphost').removeClass('hidden')\n\t\t\t$('#mail_smtpsecure_label').removeClass('hidden')\n\t\t\t$('#mail_smtpsecure').removeClass('hidden')\n\t\t\tif ($('#mail_smtpauth').is(':checked')) {\n\t\t\t\t$('#mail_credentials').removeClass('hidden')\n\t\t\t}\n\t\t\t$('#mail_sendmailmode_label, #mail_sendmailmode').addClass('hidden')\n\t\t}\n\t})\n\n\tconst changeEmailSettings = function() {\n\t\tif (OC.PasswordConfirmation.requiresPasswordConfirmation()) {\n\t\t\tOC.PasswordConfirmation.requirePasswordConfirmation(changeEmailSettings)\n\t\t\treturn\n\t\t}\n\n\t\tOC.msg.startSaving('#mail_settings_msg')\n\t\t$.ajax({\n\t\t\turl: OC.generateUrl('/settings/admin/mailsettings'),\n\t\t\ttype: 'POST',\n\t\t\tdata: $('#mail_general_settings_form').serialize(),\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'))\n\t\t\t},\n\t\t\terror: (xhr) => {\n\t\t\t\tOC.msg.finishedError('#mail_settings_msg', xhr.responseJSON)\n\t\t\t},\n\t\t})\n\t}\n\n\tconst toggleEmailCredentials = function() {\n\t\tif (OC.PasswordConfirmation.requiresPasswordConfirmation()) {\n\t\t\tOC.PasswordConfirmation.requirePasswordConfirmation(toggleEmailCredentials)\n\t\t\treturn\n\t\t}\n\n\t\tOC.msg.startSaving('#mail_settings_msg')\n\t\t$.ajax({\n\t\t\turl: OC.generateUrl('/settings/admin/mailsettings/credentials'),\n\t\t\ttype: 'POST',\n\t\t\tdata: $('#mail_credentials_settings').serialize(),\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'))\n\t\t\t},\n\t\t\terror: (xhr) => {\n\t\t\t\tOC.msg.finishedError('#mail_settings_msg', xhr.responseJSON)\n\t\t\t},\n\t\t})\n\t}\n\n\t$('#mail_general_settings_form').change(changeEmailSettings)\n\t$('#mail_credentials_settings_submit').click(toggleEmailCredentials)\n\t$('#mail_smtppassword').click(() => {\n\t\tif (this.type === 'text' && this.value === '********') {\n\t\t\tthis.type = 'password'\n\t\t\tthis.value = ''\n\t\t}\n\t})\n\n\t$('#sendtestemail').click((event) => {\n\t\tevent.preventDefault()\n\t\tOC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending…'))\n\n\t\t$.ajax({\n\t\t\turl: OC.generateUrl('/settings/admin/mailtest'),\n\t\t\ttype: 'POST',\n\t\t\tsuccess: () => {\n\t\t\t\tOC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent'))\n\t\t\t},\n\t\t\terror: (xhr) => {\n\t\t\t\tOC.msg.finishedError('#sendtestmail_msg', xhr.responseJSON)\n\t\t\t},\n\t\t})\n\t})\n\n\t$('#allowGroupSharing').change(function() {\n\t\t$('#allowGroupSharing').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#shareapiExcludeGroups').change(function() {\n\t\t$('#selectExcludedGroups').toggleClass('hidden', !this.checked)\n\t})\n\n\t$('#onlyShareWithGroupMembers').change(function() {\n\t\t$('#selectShareWithGroupMembersExcludeGroups').toggleClass('hidden', !this.checked)\n\t})\n\n\tconst setupChecks = () => {\n\t\t// run setup checks then gather error messages\n\t\t$.when(\n\t\t\tOC.SetupChecks.checkWebDAV(),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('GET', '/.well-known/webfinger', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true, [200, 404], true),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('GET', '/.well-known/nodeinfo', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true, [200, 404], true),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/carddav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocm-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocs-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),\n\t\t\tOC.SetupChecks.checkSetup(),\n\t\t\tOC.SetupChecks.checkGeneric(),\n\t\t\tOC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), OC.theme.docPlaceholderUrl),\n\t\t\tOC.SetupChecks.checkDataProtected(),\n\t\t).then((check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11) => {\n\t\t\tconst messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11)\n\t\t\tconst $el = $('#postsetupchecks')\n\t\t\t$('#security-warning-state-loading').addClass('hidden')\n\n\t\t\tlet hasMessages = false\n\t\t\tconst $errorsEl = $el.find('.errors')\n\t\t\tconst $warningsEl = $el.find('.warnings')\n\t\t\tconst $infoEl = $el.find('.info')\n\n\t\t\tfor (let i = 0; i < messages.length; i++) {\n\t\t\t\tswitch (messages[i].type) {\n\t\t\t\tcase OC.SetupChecks.MESSAGE_TYPE_INFO:\n\t\t\t\t\t$infoEl.append('
  • ' + messages[i].msg + '
  • ')\n\t\t\t\t\tbreak\n\t\t\t\tcase OC.SetupChecks.MESSAGE_TYPE_WARNING:\n\t\t\t\t\t$warningsEl.append('
  • ' + messages[i].msg + '
  • ')\n\t\t\t\t\tbreak\n\t\t\t\tcase OC.SetupChecks.MESSAGE_TYPE_ERROR:\n\t\t\t\tdefault:\n\t\t\t\t\t$errorsEl.append('
  • ' + messages[i].msg + '
  • ')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($errorsEl.find('li').length > 0) {\n\t\t\t\t$errorsEl.removeClass('hidden')\n\t\t\t\thasMessages = true\n\t\t\t}\n\t\t\tif ($warningsEl.find('li').length > 0) {\n\t\t\t\t$warningsEl.removeClass('hidden')\n\t\t\t\thasMessages = true\n\t\t\t}\n\t\t\tif ($infoEl.find('li').length > 0) {\n\t\t\t\t$infoEl.removeClass('hidden')\n\t\t\t\thasMessages = true\n\t\t\t}\n\n\t\t\tif (hasMessages) {\n\t\t\t\t$('#postsetupchecks-hint').removeClass('hidden')\n\t\t\t\tif ($errorsEl.find('li').length > 0) {\n\t\t\t\t\t$('#security-warning-state-failure').removeClass('hidden')\n\t\t\t\t} else {\n\t\t\t\t\t$('#security-warning-state-warning').removeClass('hidden')\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst securityWarning = $('#security-warning')\n\t\t\t\tif (securityWarning.children('ul').children().length === 0) {\n\t\t\t\t\t$('#security-warning-state-ok').removeClass('hidden')\n\t\t\t\t} else {\n\t\t\t\t\t$('#security-warning-state-failure').removeClass('hidden')\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tif (document.getElementById('security-warning') !== null) {\n\t\tsetupChecks()\n\t}\n\n\t$('#shareAPI').removeClass('loading')\n})\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = {};\n__webpack_modules__[39583]();\n"],"names":["window","addEventListener","$","each","index","element","OC","Settings","setupGroupsSelect","change","ev","groups","val","JSON","stringify","OCP","AppConfig","setValue","this","attr","post","generateUrl","level","Log","reload","toggleClass","checked","on","value","replace","removeAttr","trigger","savePublicShareDisclaimerText","$el","$target","target","is","PERMISSION_READ","preventDefault","_","debounce","options","success","msg","finishedSuccess","t","error","finishedError","startSaving","isString","deleteKey","removeClass","addClass","changeEmailSettings","PasswordConfirmation","requiresPasswordConfirmation","requirePasswordConfirmation","ajax","url","type","data","serialize","xhr","responseJSON","click","toggleEmailCredentials","_this","event","startAction","document","getElementById","when","SetupChecks","checkWebDAV","checkWellKnownUrl","theme","docPlaceholderUrl","checkProviderUrl","getRootPath","checkSetup","checkGeneric","checkWOFF2Loading","filePath","checkDataProtected","then","check1","check2","check3","check4","check5","check6","check7","check8","check9","check10","check11","messages","concat","hasMessages","$errorsEl","find","$warningsEl","$infoEl","i","length","MESSAGE_TYPE_INFO","append","MESSAGE_TYPE_WARNING","MESSAGE_TYPE_ERROR","children"],"sourceRoot":""} \ No newline at end of file From 4faf5793c98f3288ad7a045136d7a91afdd2ab08 Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Fri, 24 Nov 2023 18:19:07 +0100 Subject: [PATCH 15/16] Migrate admin settings to Vue Signed-off-by: Sebastien Marinier --- apps/settings/lib/Settings/Admin/Sharing.php | 2 ++ apps/settings/src/components/AdminSettingsSharingForm.vue | 8 ++++++++ apps/settings/tests/Settings/Admin/SharingTest.php | 2 ++ 3 files changed, 12 insertions(+) diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index f4d3a5c107b93..fc8b811eccdfa 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -63,6 +63,7 @@ public function getForm() { $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); $linksExcludedGroups = $this->config->getAppValue('core', 'shareapi_allow_links_exclude_groups', ''); $excludedPasswordGroups = $this->config->getAppValue('core', 'shareapi_enforce_links_password_excluded_groups', ''); + $onlyShareWithGroupMembersExcludeGroupList = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members_exclude_group_list', ''); $parameters = [ // Built-In Sharing @@ -83,6 +84,7 @@ public function getForm() { 'passwordExcludedGroups' => json_decode($excludedPasswordGroups) ?? [], 'passwordExcludedGroupsFeatureEnabled' => $this->config->getSystemValueBool('sharing.allow_disabled_password_enforcement_groups', false), 'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(), + 'onlyShareWithGroupMembersExcludeGroupList' => json_decode($onlyShareWithGroupMembersExcludeGroupList) ?? [], 'defaultExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_default_expire_date'), 'expireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'), 'enforceExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_enforce_expire_date'), diff --git a/apps/settings/src/components/AdminSettingsSharingForm.vue b/apps/settings/src/components/AdminSettingsSharingForm.vue index de23adf67d2df..2aa278821203a 100644 --- a/apps/settings/src/components/AdminSettingsSharingForm.vue +++ b/apps/settings/src/components/AdminSettingsSharingForm.vue @@ -37,6 +37,13 @@ {{ t('settings', 'Restrict users to only share with users in their groups') }} +