summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2012-06-04 10:42:09 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2012-06-04 14:00:35 +0200
commitc8f670dfab1a3f34349f197b16d25f04d26dbb4f (patch)
treefbdd7887e5cad92721213b25b881a8ca223148ef
parent8983c6dd6b13c6de5859a29c1effb32ed3f5cb7f (diff)
downloadnextcloud-server-c8f670dfab1a3f34349f197b16d25f04d26dbb4f.tar.gz
nextcloud-server-c8f670dfab1a3f34349f197b16d25f04d26dbb4f.zip
Don't allow user to delete, rename and re-share the "Shared" directory
-rw-r--r--apps/files/js/fileactions.js6
-rw-r--r--apps/files/js/files.js2
-rw-r--r--lib/files.php2
3 files changed, 6 insertions, 4 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 68268a7d3a9..085f53945a6 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -51,7 +51,7 @@ FileActions={
var actions=this.get(mime,type);
return actions[name];
},
- display:function(parent){
+ display:function(parent, filename, type){
FileActions.currentFile=parent;
$('#fileList span.fileactions, #fileList td.date a.action').remove();
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
@@ -62,6 +62,8 @@ FileActions={
parent.children('a.name').append('<span class="fileactions" />');
var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
for(name in actions){
+ // no rename and share action for the 'Shared' dir
+ if((name=='Rename' || name =='Share') && type=='dir' && filename=='Shared') { continue; }
if((name=='Download' || actions[name]!=defaultAction) && name!='Delete'){
var img=FileActions.icons[name];
if(img.call){
@@ -84,7 +86,7 @@ FileActions={
parent.find('a.name>span.fileactions').append(element);
}
}
- if(actions['Delete']){
+ if(actions['Delete'] && (type!='dir' || filename != 'Shared')){ // no delete action for the 'Shared' dir
var img=FileActions.icons['Delete'];
if(img.call){
img=img(file);
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 35d80b3cff2..40d5be2214a 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -56,7 +56,7 @@ $(document).ready(function() {
// Sets the file-action buttons behaviour :
$('tr').live('mouseenter',function(event) {
- FileActions.display($(this).children('td.filename'));
+ FileActions.display($(this).children('td.filename'), $(this).attr('data-file'), $(this).attr('data-type'));
});
$('tr').live('mouseleave',function(event) {
FileActions.hide();
diff --git a/lib/files.php b/lib/files.php
index e0c78d22c24..77f6d7f3d65 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -224,7 +224,7 @@ class OC_Files {
* @param file $name
*/
public static function delete($dir,$file){
- if(OC_User::isLoggedIn()){
+ if(OC_User::isLoggedIn() && ($dir!= '' || $file != 'Shared')) {
$file=$dir.'/'.$file;
return OC_Filesystem::unlink($file);
}