From: Michael Gapczynski Date: Wed, 25 Apr 2012 15:51:18 +0000 (-0400) Subject: Allow admin to disable resharing of files X-Git-Tag: v4.0.0beta~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b369adbd9487496d799cf04f66fcc72a002ccda5;p=nextcloud-server.git Allow admin to disable resharing of files --- diff --git a/apps/files_sharing/ajax/toggleresharing.php b/apps/files_sharing/ajax/toggleresharing.php new file mode 100644 index 00000000000..fd16b208be1 --- /dev/null +++ b/apps/files_sharing/ajax/toggleresharing.php @@ -0,0 +1,16 @@ + diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 8049e9b0ae3..117b65d754f 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -3,10 +3,14 @@ require_once('apps/files_sharing/sharedstorage.php'); OC::$CLASSPATH['OC_Share'] = "apps/files_sharing/lib_share.php"; +OC_APP::registerAdmin('files_sharing', 'settings'); OC_Hook::connect("OC_Filesystem", "post_delete", "OC_Share", "deleteItem"); OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Share", "renameItem"); OC_Hook::connect("OC_Filesystem", "post_write", "OC_Share", "updateItem"); -OC_Util::addScript("files_sharing", "share"); +$dir = isset($_GET['dir']) ? $_GET['dir'] : '/'; +if ($dir != '/Shared' || OC_Appconfig::getValue('files_sharing', 'resharing', 'yes') == 'yes') { + OC_Util::addScript("files_sharing", "share"); +} OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min"); OC_Util::addStyle( 'files_sharing', 'sharing' ); OC_Util::addStyle("3rdparty", "chosen/chosen"); diff --git a/apps/files_sharing/js/settings.js b/apps/files_sharing/js/settings.js new file mode 100644 index 00000000000..f1b1643e7d6 --- /dev/null +++ b/apps/files_sharing/js/settings.js @@ -0,0 +1,9 @@ +$(document).ready(function() { + $('#allowResharing').bind('change', function() { + var checked = 1; + if (!$('#allowResharing').attr('checked')) { + checked = 0; + } + $.post(OC.filePath('files_sharing','ajax','toggleresharing.php'), 'resharing='+checked); + }); +}); \ No newline at end of file diff --git a/apps/files_sharing/settings.php b/apps/files_sharing/settings.php new file mode 100644 index 00000000000..b30c4f45cde --- /dev/null +++ b/apps/files_sharing/settings.php @@ -0,0 +1,9 @@ +assign('allowResharing', OC_Appconfig::getValue('files_sharing', 'resharing', 'yes')); +return $tmpl->fetchPage(); + +?> \ No newline at end of file diff --git a/apps/files_sharing/templates/settings.php b/apps/files_sharing/templates/settings.php new file mode 100644 index 00000000000..5b6ba5f33ee --- /dev/null +++ b/apps/files_sharing/templates/settings.php @@ -0,0 +1,6 @@ +
+
+ />
+ t('Allow users to reshare files they don\'t own');?> +
+
\ No newline at end of file