new admin setting added which allows to turn off anonymous uploads

This commit is contained in:
Thomas Müller 2013-07-12 17:03:51 +02:00
parent 8ae2066b20
commit fc2d538311
5 changed files with 19 additions and 4 deletions

View File

@ -138,5 +138,6 @@ if ($needUpgrade) {
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
$tmpl->assign('isPublic', false); $tmpl->assign('isPublic', false);
$tmpl->assign('publicUploadEnabled', \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
$tmpl->printPage(); $tmpl->printPage();
} }

View File

@ -61,7 +61,7 @@
<div id="emptyfolder"><?php p($l->t('Nothing in here. Upload something!'))?></div> <div id="emptyfolder"><?php p($l->t('Nothing in here. Upload something!'))?></div>
<?php endif; ?> <?php endif; ?>
<table id="filestable"> <table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>">
<thead> <thead>
<tr> <tr>
<th id='headerName'> <th id='headerName'>

View File

@ -161,7 +161,12 @@ OC.Share={
// respective checkbox should be checked or // respective checkbox should be checked or
// not. // not.
var publicUploadEnabled = $('#filestable').data('allow-public-upload');
if (typeof publicUploadEnabled == 'undefined') {
publicUploadEnabled = 'no';
}
var allowPublicUploadStatus = false; var allowPublicUploadStatus = false;
$.each(data.shares, function(key, value) { $.each(data.shares, function(key, value) {
if (allowPublicUploadStatus) { if (allowPublicUploadStatus) {
return true; return true;
@ -181,7 +186,7 @@ OC.Share={
html += '<div id="linkPass">'; html += '<div id="linkPass">';
html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />'; html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />';
html += '</div>'; 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 += '<div id="allowPublicUploadWrapper" style="display:none;">';
html += '<input type="checkbox" value="1" name="allowPublicUpload" id="sharingDialogAllowPublicUpload"' + ((allowPublicUploadStatus) ? 'checked="checked"' : '') + ' />'; html += '<input type="checkbox" value="1" name="allowPublicUpload" id="sharingDialogAllowPublicUpload"' + ((allowPublicUploadStatus) ? 'checked="checked"' : '') + ' />';
html += '<label for="sharingDialogAllowPublicUpload">' + t('core', 'Allow Public Upload') + '</label>'; html += '<label for="sharingDialogAllowPublicUpload">' + t('core', 'Allow Public Upload') + '</label>';

View File

@ -41,6 +41,7 @@ $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('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('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
$tmpl->assign('sharePolicy', OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global')); $tmpl->assign('sharePolicy', OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global'));
$tmpl->assign('forms', array()); $tmpl->assign('forms', array());

View File

@ -145,6 +145,14 @@ if (!$_['internetconnectionworking']) {
<em><?php p($l->t('Allow users to share items to the public with links')); ?></em> <em><?php p($l->t('Allow users to share items to the public with links')); ?></em>
</td> </td>
</tr> </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> <tr>
<td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>> <td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" <input type="checkbox" name="shareapi_allow_resharing" id="allowResharing"