diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-03-25 17:32:49 +0100 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-04-15 10:06:09 +0200 |
commit | af61486aea90cfc1a82301ce624dffb59ed01e07 (patch) | |
tree | 9b608272439503e0015ece40ae4b77013eabc81f /apps/settings | |
parent | 2650da70caa73c8bf3119edebb37e91d67f3a214 (diff) | |
download | nextcloud-server-af61486aea90cfc1a82301ce624dffb59ed01e07.tar.gz nextcloud-server-af61486aea90cfc1a82301ce624dffb59ed01e07.zip |
Separate settings for remote share expiration
Added separate settings for default and enforced expiration date for
remote shares.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/settings')
-rw-r--r-- | apps/settings/js/admin.js | 4 | ||||
-rw-r--r-- | apps/settings/lib/Settings/Admin/Sharing.php | 3 | ||||
-rw-r--r-- | apps/settings/templates/settings/admin/sharing.php | 23 | ||||
-rw-r--r-- | apps/settings/tests/Settings/Admin/SharingTest.php | 12 |
4 files changed, 42 insertions, 0 deletions
diff --git a/apps/settings/js/admin.js b/apps/settings/js/admin.js index ba6b480c79d..271d13b43d0 100644 --- a/apps/settings/js/admin.js +++ b/apps/settings/js/admin.js @@ -90,6 +90,10 @@ window.addEventListener('DOMContentLoaded', function(){ $("#setDefaultInternalExpireDate").toggleClass('hidden', !this.checked); }); + $('#shareapiDefaultRemoteExpireDate').change(function() { + $("#setDefaultRemoteExpireDate").toggleClass('hidden', !this.checked); + }); + $('#publicShareDisclaimer').change(function() { $("#publicShareDisclaimerText").toggleClass('hidden', !this.checked); if(!this.checked) { diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index 6285ef399a8..7eb9649a1aa 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -90,6 +90,9 @@ class Sharing implements ISettings { 'shareDefaultInternalExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no'), 'shareInternalExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'), 'shareInternalEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no'), + 'shareDefaultRemoteExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no'), + 'shareRemoteExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'), + 'shareRemoteEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no'), ]; return new TemplateResponse('settings', 'settings/admin/sharing', $parameters, ''); diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index 9938955ae3d..4bb2ddca7d9 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -63,6 +63,29 @@ <label for="shareapiInternalEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/> </p> + <p id="remoteShareSettings" class="indent <?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +} ?>"> + <input type="checkbox" name="shareapi_default_remote_expire_date" id="shareapiDefaultRemoteExpireDate" class="checkbox" + value="1" <?php if ($_['shareDefaultRemoteExpireDateSet'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> + <label for="shareapiDefaultRemoteExpireDate"><?php p($l->t('Set default expiration date for shares to other servers'));?></label><br/> + </p> + <p id="setDefaultRemoteExpireDate" class="double-indent <?php if ($_['shareDefaultRemoteExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> + <?php p($l->t('Expire after ')); ?> + <input type="text" name='shareapi_remote_expire_after_n_days' id="shareapiRemoteExpireAfterNDays" placeholder="<?php p('7')?>" + value='<?php p($_['shareRemoteExpireAfterNDays']) ?>' /> + <?php p($l->t('days')); ?> + <input type="checkbox" name="shareapi_enforce_remote_expire_date" id="shareapiRemoteEnforceExpireDate" class="checkbox" + value="1" <?php if ($_['shareRemoteEnforceExpireDate'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> + <label for="shareapiRemoteEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/> + </p> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { p('hidden'); }?>"> diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index 1f24ef13d4b..041c4f1717a 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -86,6 +86,9 @@ class SharingTest extends TestCase { ['core', 'shareapi_default_internal_expire_date', 'no', 'no'], ['core', 'shareapi_internal_expire_after_n_days', '7', '7'], ['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'], + ['core', 'shareapi_default_remote_expire_date', 'no', 'no'], + ['core', 'shareapi_remote_expire_after_n_days', '7', '7'], + ['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'], ]); $expected = new TemplateResponse( @@ -115,6 +118,9 @@ class SharingTest extends TestCase { 'shareDefaultInternalExpireDateSet' => 'no', 'shareInternalExpireAfterNDays' => '7', 'shareInternalEnforceExpireDate' => 'no', + 'shareDefaultRemoteExpireDateSet' => 'no', + 'shareRemoteExpireAfterNDays' => '7', + 'shareRemoteEnforceExpireDate' => 'no', ], '' ); @@ -146,6 +152,9 @@ class SharingTest extends TestCase { ['core', 'shareapi_default_internal_expire_date', 'no', 'no'], ['core', 'shareapi_internal_expire_after_n_days', '7', '7'], ['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'], + ['core', 'shareapi_default_remote_expire_date', 'no', 'no'], + ['core', 'shareapi_remote_expire_after_n_days', '7', '7'], + ['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'], ]); $expected = new TemplateResponse( @@ -175,6 +184,9 @@ class SharingTest extends TestCase { 'shareDefaultInternalExpireDateSet' => 'no', 'shareInternalExpireAfterNDays' => '7', 'shareInternalEnforceExpireDate' => 'no', + 'shareDefaultRemoteExpireDateSet' => 'no', + 'shareRemoteExpireAfterNDays' => '7', + 'shareRemoteEnforceExpireDate' => 'no', ], '' ); |