summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-21 11:29:40 +0200
committerVincent Petry <pvince81@owncloud.com>2013-10-21 11:29:40 +0200
commitf8717bc26005912f14fb0da52b7dd66f86f3b929 (patch)
tree60180a1d55f28eb05f76a65eb8e8f96083a12a1c
parentf5a6d6b43e6a91d0e9ef0940e1a83530f5a5cff6 (diff)
downloadnextcloud-server-f8717bc26005912f14fb0da52b7dd66f86f3b929.tar.gz
nextcloud-server-f8717bc26005912f14fb0da52b7dd66f86f3b929.zip
Fixed share with link checkbox missing as regular user
Instead of loading the app config setting "shareapi_allow_links" using a synchronous ajax call that fails when the user is not an admin, this fix puts the flag directly in the template so it doesn't need to be loaded afterwards. Fixes #5440
-rw-r--r--apps/files/index.php1
-rw-r--r--apps/files/templates/index.php2
-rw-r--r--core/js/share.js13
3 files changed, 4 insertions, 12 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 8d877be8ac9..2f1e084560b 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -138,6 +138,7 @@ if ($needUpgrade) {
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
$tmpl->assign("mailNotificationEnabled", \OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'yes'));
+ $tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
$tmpl->assign('disableSharing', false);
$tmpl->assign('ajaxLoad', $ajaxLoad);
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 32a59f1e1a6..001adb77ab5 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -114,3 +114,5 @@
<input type="hidden" name="encryptedFiles" id="encryptedFiles" value="<?php $_['encryptedFiles'] ? p('1') : p('0'); ?>" />
<input type="hidden" name="encryptedInitStatus" id="encryptionInitStatus" value="<?php p($_['encryptionInitStatus']) ?>" />
<input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" />
+<input type="hidden" name="allowShareWithLink" id="allowShareWithLink" value="<?php p($_['allowShareWithLink']) ?>" />
+
diff --git a/core/js/share.js b/core/js/share.js
index 6ec15f01c1e..9c606b9de62 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -203,18 +203,7 @@ OC.Share={
html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Share with')+'" />';
html += '<ul id="shareWithList">';
html += '</ul>';
- var linksAllowed = false;
- $.ajax({
- type: 'GET',
- url: OC.filePath('core', 'ajax', 'appconfig.php'),
- data: { action:'getValue', app:'core', key:'shareapi_allow_links', defaultValue:'yes' },
- async: false,
- success: function(result) {
- if (result && result.status === 'success' && result.data === 'yes') {
- linksAllowed = true;
- }
- }
- });
+ var linksAllowed = $('#allowShareWithLink').val() === 'yes';
if (link && linksAllowed) {
html += '<div id="link">';
html += '<input type="checkbox" name="linkCheckbox" id="linkCheckbox" value="1" /><label for="linkCheckbox">'+t('core', 'Share with link')+'</label>';