]> source.dussan.org Git - nextcloud-server.git/commitdiff
new admin setting added which allows to turn off anonymous uploads
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 12 Jul 2013 15:03:51 +0000 (17:03 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Fri, 12 Jul 2013 15:03:51 +0000 (17:03 +0200)
apps/files/index.php
apps/files/templates/index.php
core/js/share.js
settings/admin.php
settings/templates/admin.php

index 2338cf439e4c625ce2f4d655b832bf0a6fef4827..892f75a3513e74c815a2a2d7cae9903e6b2cf818 100644 (file)
@@ -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();
 }
index 7d679bc4bf65434cc14be3369d9df7c7230d1c9d..dacd2be0b32a5925993c69a22aa509c2f774cd39 100644 (file)
@@ -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'>
index 21e352ee1c656bc94eb165eab4f221a38fc3ea31..4c8fd8741074ca183c2cc5dca9e596284eba794c 100644 (file)
@@ -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>';
index db041ef889c08e527fd9bdffc0b514e37b50c0ed..cc30c70d47413483a69f3df9428b03fd3316fa6f 100755 (executable)
@@ -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());
index 4af53a649b89840aff14bf8c4e05eeb16b81b2e7..9f16db0948d124051cc0c28dfc2efe10fc39345a 100644 (file)
@@ -140,11 +140,19 @@ 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"