always allow to rename the share mount point
This commit is contained in:
parent
b102222fed
commit
7ef8f6d352
4 changed files with 26 additions and 2 deletions
|
@ -178,6 +178,13 @@ window.FileList = {
|
||||||
if (type === 'dir') {
|
if (type === 'dir') {
|
||||||
mime = mime || 'httpd/unix-directory';
|
mime = mime || 'httpd/unix-directory';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// user should always be able to rename a share mount point
|
||||||
|
var allowRename = 0;
|
||||||
|
if (fileData.isShareMountPoint) {
|
||||||
|
allowRename = OC.PERMISSION_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
//containing tr
|
//containing tr
|
||||||
var tr = $('<tr></tr>').attr({
|
var tr = $('<tr></tr>').attr({
|
||||||
"data-id" : fileData.id,
|
"data-id" : fileData.id,
|
||||||
|
@ -187,7 +194,7 @@ window.FileList = {
|
||||||
"data-mime": mime,
|
"data-mime": mime,
|
||||||
"data-mtime": mtime,
|
"data-mtime": mtime,
|
||||||
"data-etag": fileData.etag,
|
"data-etag": fileData.etag,
|
||||||
"data-permissions": fileData.permissions || this.getDirectoryPermissions()
|
"data-permissions": fileData.permissions | allowRename || this.getDirectoryPermissions()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (type === 'dir') {
|
if (type === 'dir') {
|
||||||
|
@ -283,6 +290,10 @@ window.FileList = {
|
||||||
mime = fileData.mimetype,
|
mime = fileData.mimetype,
|
||||||
permissions = parseInt(fileData.permissions, 10) || 0;
|
permissions = parseInt(fileData.permissions, 10) || 0;
|
||||||
|
|
||||||
|
if (fileData.isShareMountPoint) {
|
||||||
|
permissions = permissions | OC.PERMISSION_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
if (type === 'dir') {
|
if (type === 'dir') {
|
||||||
mime = mime || 'httpd/unix-directory';
|
mime = mime || 'httpd/unix-directory';
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ class Helper
|
||||||
if (isset($i['displayname_owner'])) {
|
if (isset($i['displayname_owner'])) {
|
||||||
$entry['shareOwner'] = $i['displayname_owner'];
|
$entry['shareOwner'] = $i['displayname_owner'];
|
||||||
}
|
}
|
||||||
|
if (isset($i['is_share_mount_point'])) {
|
||||||
|
$entry['isShareMountPoint'] = $i['is_share_mount_point'];
|
||||||
|
}
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,9 @@ class Shared_Cache extends Cache {
|
||||||
$data = $cache->get($this->files[$file]);
|
$data = $cache->get($this->files[$file]);
|
||||||
$data['displayname_owner'] = \OC_User::getDisplayName($this->storage->getSharedFrom());
|
$data['displayname_owner'] = \OC_User::getDisplayName($this->storage->getSharedFrom());
|
||||||
$data['path'] = $path;
|
$data['path'] = $path;
|
||||||
|
if ($file === '') {
|
||||||
|
$data['is_share_mount_point'] = true;
|
||||||
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,6 +126,7 @@ class Shared_Cache extends Cache {
|
||||||
}
|
}
|
||||||
if (isset($mountPoint)) {
|
if (isset($mountPoint)) {
|
||||||
$data['path'] = 'files/' . $mountPoint;
|
$data['path'] = 'files/' . $mountPoint;
|
||||||
|
$data['is_share_mount_point'] = true;
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,15 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
list($sourceDir,) = \Sabre_DAV_URLUtil::splitPath($sourcePath);
|
list($sourceDir,) = \Sabre_DAV_URLUtil::splitPath($sourcePath);
|
||||||
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destinationPath);
|
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destinationPath);
|
||||||
|
|
||||||
|
$isShareMountPoint = false;
|
||||||
|
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath( '/' . \OCP\User::getUser() . '/files/' . $sourcePath);
|
||||||
|
if ($storage instanceof \OC\Files\Storage\Shared && !$internalPath) {
|
||||||
|
$isShareMountPoint = true;
|
||||||
|
}
|
||||||
|
|
||||||
// check update privileges
|
// check update privileges
|
||||||
$fs = $this->getFileView();
|
$fs = $this->getFileView();
|
||||||
if (!$fs->isUpdatable($sourcePath)) {
|
if (!$fs->isUpdatable($sourcePath) && !$isShareMountPoint) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre_DAV_Exception_Forbidden();
|
||||||
}
|
}
|
||||||
if ($sourceDir !== $destinationDir) {
|
if ($sourceDir !== $destinationDir) {
|
||||||
|
|
Loading…
Reference in a new issue