diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-12-01 11:35:01 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-02-27 12:29:25 +0100 |
commit | 1615312bf1044dcbd98c7e4739467314ada618cf (patch) | |
tree | 9788f5cb7fe746078953cafadf78e3b2e845d52b /settings | |
parent | 7d0102bf7302a483209e0d1c926260713f0e56c6 (diff) | |
download | nextcloud-server-1615312bf1044dcbd98c7e4739467314ada618cf.tar.gz nextcloud-server-1615312bf1044dcbd98c7e4739467314ada618cf.zip |
add share permissions to settings page
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/css/settings.scss | 7 | ||||
-rw-r--r-- | settings/js/admin.js | 22 | ||||
-rw-r--r-- | settings/templates/settings/admin/sharing.php | 12 |
3 files changed, 41 insertions, 0 deletions
diff --git a/settings/css/settings.scss b/settings/css/settings.scss index 05d62423d17..611961b1065 100644 --- a/settings/css/settings.scss +++ b/settings/css/settings.scss @@ -1030,6 +1030,13 @@ table.grid td.date { .double-indent { padding-left: 56px; } + .nocheckbox { + padding-left: 20px; + } +} + +#shareApiDefaultPermissionsSection label { + margin-right: 20px; } #fileSharingSettings h3 { diff --git a/settings/js/admin.js b/settings/js/admin.js index 177f6d3f7f4..f637cb64592 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -121,6 +121,28 @@ $(document).ready(function(){ } }); + $('#shareApiDefaultPermissionsSection input').change(function(ev) { + var $el = $('#shareApiDefaultPermissions'); + var $target = $(ev.target); + + var value = $el.val(); + if ($target.is(':checked')) { + value = value | $target.val(); + } else { + value = value & ~$target.val(); + } + + // always set read permission + value |= OC.PERMISSION_READ; + + // this will trigger the field's change event and will save it + $el.val(value).change(); + + ev.preventDefault(); + + return false; + }); + var savePublicShareDisclaimerText = _.debounce(function(value) { var options = { success: function() { diff --git a/settings/templates/settings/admin/sharing.php b/settings/templates/settings/admin/sharing.php index 156e8ddd81d..1f8e72910c4 100644 --- a/settings/templates/settings/admin/sharing.php +++ b/settings/templates/settings/admin/sharing.php @@ -78,6 +78,18 @@ value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> /> <label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br /> </p> + <p class="nocheckbox <?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <input type="hidden" name="shareapi_default_permissions" id="shareApiDefaultPermissions" class="checkbox" + value="<?php p($_['shareApiDefaultPermissions']) ?>" /> + <?php p($l->t('Default user and group share permissions'));?> + </p> + <p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>"> + <?php foreach ($_['shareApiDefaultPermissionsCheckboxes'] as $perm): ?> + <input type="checkbox" name="shareapi_default_permission_<?php p($perm['id']) ?>" id="shareapi_default_permission_<?php p($perm['id']) ?>" + class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) print_unescaped('checked="checked"'); ?> /> + <label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']);?></label> + <?php endforeach ?> + </p> <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> <input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox" value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> /> |