summaryrefslogtreecommitdiffstats
path: root/apps/settings
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-05-21 15:35:39 +0200
committerGitHub <noreply@github.com>2021-05-21 15:35:39 +0200
commitf1dbabd9109c08e62d6f82124c63201c96ad2203 (patch)
treeea6b862c1fa97ec5ad03895c120268bd25d1d35e /apps/settings
parentb1ad3faf14140e3c85a7eec1dade88cd551cc747 (diff)
parent8d7fae8fae054eaa08635fea3ba092196c6f8b84 (diff)
downloadnextcloud-server-f1dbabd9109c08e62d6f82124c63201c96ad2203.tar.gz
nextcloud-server-f1dbabd9109c08e62d6f82124c63201c96ad2203.zip
Merge pull request #26727 from nextcloud/group-exclude-link-share
Add option to exclude groups from creating link shares
Diffstat (limited to 'apps/settings')
-rw-r--r--apps/settings/js/admin.js2
-rw-r--r--apps/settings/lib/Settings/Admin/Sharing.php4
-rw-r--r--apps/settings/templates/settings/admin/sharing.php10
-rw-r--r--apps/settings/tests/Settings/Admin/SharingTest.php6
4 files changed, 20 insertions, 2 deletions
diff --git a/apps/settings/js/admin.js b/apps/settings/js/admin.js
index 271d13b43d0..f749c9e132c 100644
--- a/apps/settings/js/admin.js
+++ b/apps/settings/js/admin.js
@@ -1,5 +1,5 @@
window.addEventListener('DOMContentLoaded', function(){
- $('#excludedGroups').each(function (index, element) {
+ $('#excludedGroups,#linksExcludedGroups').each(function (index, element) {
OC.Settings.setupGroupsSelect($(element));
$(element).change(function(ev) {
var groups = ev.val || [];
diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php
index 7eb9649a1aa..8d759b4ae85 100644
--- a/apps/settings/lib/Settings/Admin/Sharing.php
+++ b/apps/settings/lib/Settings/Admin/Sharing.php
@@ -64,11 +64,15 @@ class Sharing implements ISettings {
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
$excludeGroupsList = !is_null(json_decode($excludedGroups))
? implode('|', json_decode($excludedGroups, true)) : '';
+ $linksExcludedGroups = $this->config->getAppValue('core', 'shareapi_allow_links_exclude_groups', '');
+ $linksExcludeGroupsList = !is_null(json_decode($linksExcludedGroups))
+ ? implode('|', json_decode($linksExcludedGroups, true)) : '';
$parameters = [
// Built-In Sharing
'allowGroupSharing' => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'),
'allowLinks' => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'),
+ 'allowLinksExcludeGroups' => $linksExcludeGroupsList,
'allowPublicUpload' => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'),
'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'),
'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'),
diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php
index 4bb2ddca7d9..9b562cface6 100644
--- a/apps/settings/templates/settings/admin/sharing.php
+++ b/apps/settings/templates/settings/admin/sharing.php
@@ -138,6 +138,14 @@
<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
p('hidden');
}?>">
+ <p class="indent">
+ <?php p($l->t('Exclude groups from creating link shares:'));?>
+ </p>
+ <p id="selectLinksExcludedGroups" class="indent <?php if ($_['allowLinks'] === 'no') {
+ p('hidden');
+} ?>">
+ <input name="shareapi_allow_links_exclude_groups" type="hidden" id="linksExcludedGroups" value="<?php p($_['allowLinksExcludeGroups']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
+ </p>
<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox"
value="1" <?php if ($_['allowResharing'] === 'yes') {
print_unescaped('checked="checked"');
@@ -176,7 +184,7 @@
} ?>">
<input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
<br />
- <em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
+ <em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
</p>
<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php
index 041c4f1717a..2703eddcd5c 100644
--- a/apps/settings/tests/Settings/Admin/SharingTest.php
+++ b/apps/settings/tests/Settings/Admin/SharingTest.php
@@ -90,6 +90,8 @@ class SharingTest extends TestCase {
['core', 'shareapi_remote_expire_after_n_days', '7', '7'],
['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'],
]);
+ $this->shareManager->method('shareWithGroupMembersOnly')
+ ->willReturn(false);
$expected = new TemplateResponse(
'settings',
@@ -121,6 +123,7 @@ class SharingTest extends TestCase {
'shareDefaultRemoteExpireDateSet' => 'no',
'shareRemoteExpireAfterNDays' => '7',
'shareRemoteEnforceExpireDate' => 'no',
+ 'allowLinksExcludeGroups' => '',
],
''
);
@@ -156,6 +159,8 @@ class SharingTest extends TestCase {
['core', 'shareapi_remote_expire_after_n_days', '7', '7'],
['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'],
]);
+ $this->shareManager->method('shareWithGroupMembersOnly')
+ ->willReturn(false);
$expected = new TemplateResponse(
'settings',
@@ -187,6 +192,7 @@ class SharingTest extends TestCase {
'shareDefaultRemoteExpireDateSet' => 'no',
'shareRemoteExpireAfterNDays' => '7',
'shareRemoteEnforceExpireDate' => 'no',
+ 'allowLinksExcludeGroups' => '',
],
''
);