summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-09-05 21:46:59 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-09-05 21:47:09 -0400
commita5211e31bc170f44edce3c80df831e7705e93396 (patch)
tree9dccdc748433d82a7af1bfb9064143a8d5a4f4df /apps/files
parentaf3e7674898251f27cc5ec4fe5337583a1eb2398 (diff)
downloadnextcloud-server-a5211e31bc170f44edce3c80df831e7705e93396.tar.gz
nextcloud-server-a5211e31bc170f44edce3c80df831e7705e93396.zip
Add permissions to new files/folders, bug fix for oc-1649
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/index.php12
-rw-r--r--apps/files/js/filelist.js4
-rw-r--r--apps/files/templates/index.php1
3 files changed, 15 insertions, 2 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 6d53527025a..ba785f7d6bc 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -89,11 +89,23 @@ $freeSpace=OC_Filesystem::free_space('/');
$freeSpace=max($freeSpace,0);
$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
+$permissions = OCP\Share::PERMISSION_READ;
+if (OC_Filesystem::isUpdatable($dir.'/')) {
+ $permissions |= OCP\Share::PERMISSION_UPDATE;
+}
+if (OC_Filesystem::isDeletable($dir.'/')) {
+ $permissions |= OCP\Share::PERMISSION_DELETE;
+}
+if (OC_Filesystem::isSharable($dir.'/')) {
+ $permissions |= OCP\Share::PERMISSION_SHARE;
+}
+
$tmpl = new OCP\Template( 'files', 'index', 'user' );
$tmpl->assign( 'fileList', $list->fetchPage(), false );
$tmpl->assign( 'breadcrumb', $breadcrumbNav->fetchPage(), false );
$tmpl->assign( 'dir', OC_Filesystem::normalizePath($dir));
$tmpl->assign( 'isCreatable', OC_Filesystem::isCreatable($dir.'/'));
+$tmpl->assign('permissions', $permissions);
$tmpl->assign( 'files', $files );
$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign( 'uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index ce215cb8431..a9e48f24052 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -5,7 +5,7 @@ var FileList={
},
addFile:function(name,size,lastModified,loading,hidden){
var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png');
- var html='<tr data-type="file" data-size="'+size+'">';
+ var html='<tr data-type="file" data-size="'+size+'" data-permissions="'+$('#permissions').val()+'">';
if(name.indexOf('.')!=-1){
var basename=name.substr(0,name.lastIndexOf('.'));
var extension=name.substr(name.lastIndexOf('.'));
@@ -41,7 +41,7 @@ var FileList={
}
},
addDir:function(name,size,lastModified,hidden){
- html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name});
+ html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name, "data-permissions": $('#permissions').val()});
td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' });
td.append('<input type="checkbox" />');
var link_elem = $('<a></a>').attr({ "class": "name", "href": OC.linkTo('files', 'index.php')+"&dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') });
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index bcf683ae4a8..a874529330b 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -32,6 +32,7 @@
<?php else:?>
<input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
<?php endif;?>
+ <input type="hidden" name="permissions" value="<?php echo $_['permissions']; ?>" id="permissions">
</div>
<div id='notification'></div>