summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-07-12 17:03:51 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-07-12 17:03:51 +0200
commitfc2d5383119f548f58b5000ebb94422b7feb08a7 (patch)
treeace8d4a7b0c08618de4daa1f1580ecaac039f26e
parent8ae2066b203e5420fa48d6717192db7e96343a2a (diff)
downloadnextcloud-server-fc2d5383119f548f58b5000ebb94422b7feb08a7.tar.gz
nextcloud-server-fc2d5383119f548f58b5000ebb94422b7feb08a7.zip
new admin setting added which allows to turn off anonymous uploads
-rw-r--r--apps/files/index.php1
-rw-r--r--apps/files/templates/index.php2
-rw-r--r--core/js/share.js7
-rwxr-xr-xsettings/admin.php3
-rw-r--r--settings/templates/admin.php10
5 files changed, 19 insertions, 4 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 2338cf439e4..892f75a3513 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -138,5 +138,6 @@ if ($needUpgrade) {
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
$tmpl->assign('isPublic', false);
+ $tmpl->assign('publicUploadEnabled', \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
$tmpl->printPage();
}
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 7d679bc4bf6..dacd2be0b32 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -61,7 +61,7 @@
<div id="emptyfolder"><?php p($l->t('Nothing in here. Upload something!'))?></div>
<?php endif; ?>
-<table id="filestable">
+<table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>">
<thead>
<tr>
<th id='headerName'>
diff --git a/core/js/share.js b/core/js/share.js
index 21e352ee1c6..4c8fd874107 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -161,7 +161,12 @@ OC.Share={
// respective checkbox should be checked or
// not.
+ var publicUploadEnabled = $('#filestable').data('allow-public-upload');
+ if (typeof publicUploadEnabled == 'undefined') {
+ publicUploadEnabled = 'no';
+ }
var allowPublicUploadStatus = false;
+
$.each(data.shares, function(key, value) {
if (allowPublicUploadStatus) {
return true;
@@ -181,7 +186,7 @@ OC.Share={
html += '<div id="linkPass">';
html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />';
html += '</div>';
- if (itemType === 'folder' && (possiblePermissions & OC.PERMISSION_CREATE)) {
+ if (itemType === 'folder' && (possiblePermissions & OC.PERMISSION_CREATE) && publicUploadEnabled === 'yes') {
html += '<div id="allowPublicUploadWrapper" style="display:none;">';
html += '<input type="checkbox" value="1" name="allowPublicUpload" id="sharingDialogAllowPublicUpload"' + ((allowPublicUploadStatus) ? 'checked="checked"' : '') + ' />';
html += '<label for="sharingDialogAllowPublicUpload">' + t('core', 'Allow Public Upload') + '</label>';
diff --git a/settings/admin.php b/settings/admin.php
index db041ef889c..cc30c70d474 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -38,9 +38,10 @@ if (OC_Request::serverProtocol() == 'https') {
$connectedHTTPS = false;
}
$tmpl->assign('isConnectedViaHTTPS', $connectedHTTPS);
-$tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false));
+$tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false));
$tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
+$tmpl->assign('allowPublicUpload', OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
$tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
$tmpl->assign('sharePolicy', OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global'));
$tmpl->assign('forms', array());
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index 4af53a649b8..9f16db0948d 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -140,13 +140,21 @@ if (!$_['internetconnectionworking']) {
<tr>
<td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
<input type="checkbox" name="shareapi_allow_links" id="allowLinks"
- value="1" <?php if ($_['allowLinks'] == 'yes') print_unescaped('checked="checked"'); ?> />
+ value="1" <?php if ($_['allowLinks'] == 'yes') print_unescaped('checked="checked"'); ?> />
<label for="allowLinks"><?php p($l->t('Allow links'));?></label><br/>
<em><?php p($l->t('Allow users to share items to the public with links')); ?></em>
</td>
</tr>
<tr>
<td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
+ <input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload"
+ value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> />
+ <label for="allowPublicUpload"><?php p($l->t('Allow anonymous uploads'));?></label><br/>
+ <em><?php p($l->t('Allow users to enable others to anonymously upload into their publicly shared folders')); ?></em>
+ </td>
+ </tr>
+ <tr>
+ <td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing"
value="1" <?php if ($_['allowResharing'] == 'yes') print_unescaped('checked="checked"'); ?> />
<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>