summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/sharedstorage.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/sharedstorage.php')
-rw-r--r--apps/files_sharing/lib/sharedstorage.php62
1 files changed, 23 insertions, 39 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 4733dff3d14..4b69276d05a 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -36,7 +36,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @breif get id of the mount point
+ * get id of the mount point
* @return string
*/
public function getId() {
@@ -44,7 +44,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @breif get file cache of the shared item source
+ * get file cache of the shared item source
* @return string
*/
public function getSourceId() {
@@ -52,9 +52,8 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the source file path, permissions, and owner for a shared file
- * @param string Shared target file path
- * @param string $target
+ * Get the source file path, permissions, and owner for a shared file
+ * @param string $target Shared target file path
* @return Returns array with the keys path, permissions, and owner or false if not found
*/
public function getFile($target) {
@@ -76,9 +75,8 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the source file path for a shared file
- * @param string Shared target file path
- * @param string $target
+ * Get the source file path for a shared file
+ * @param string $target Shared target file path
* @return string source file path or false if not found
*/
public function getSourcePath($target) {
@@ -100,16 +98,17 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the permissions granted for a shared file
- * @param string Shared target file path
- * @return int CRUDS permissions granted or false if not found
+ * Get the permissions granted for a shared file
+ * @param string $target Shared target file path
+ * @return int CRUDS permissions granted
*/
public function getPermissions($target) {
- $source = $this->getFile($target);
- if ($source) {
- return $source['permissions'];
+ $permissions = $this->share['permissions'];
+ // part file are always have delete permissions
+ if (pathinfo($target, PATHINFO_EXTENSION) === 'part') {
+ $permissions |= \OCP\PERMISSION_DELETE;
}
- return false;
+ return $permissions;
}
public function mkdir($path) {
@@ -183,9 +182,6 @@ class Shared extends \OC\Files\Storage\Common {
}
public function isCreatable($path) {
- if ($path == '') {
- $path = $this->getMountPoint();
- }
return ($this->getPermissions($path) & \OCP\PERMISSION_CREATE);
}
@@ -194,23 +190,14 @@ class Shared extends \OC\Files\Storage\Common {
}
public function isUpdatable($path) {
- if ($path == '') {
- $path = $this->getMountPoint();
- }
return ($this->getPermissions($path) & \OCP\PERMISSION_UPDATE);
}
public function isDeletable($path) {
- if ($path == '') {
- $path = $this->getMountPoint();
- }
return ($this->getPermissions($path) & \OCP\PERMISSION_DELETE);
}
public function isSharable($path) {
- if ($path == '') {
- $path = $this->getMountPoint();
- }
return ($this->getPermissions($path) & \OCP\PERMISSION_SHARE);
}
@@ -276,7 +263,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Format a path to be relative to the /user/files/ directory
+ * Format a path to be relative to the /user/files/ directory
* @param string $path the absolute path
* @return string e.g. turns '/admin/files/test.txt' into '/test.txt'
*/
@@ -300,7 +287,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief rename a shared folder/file
+ * rename a shared folder/file
* @param string $sourcePath
* @param string $targetPath
* @return bool
@@ -454,9 +441,6 @@ class Shared extends \OC\Files\Storage\Common {
}
public function free_space($path) {
- if ($path == '') {
- $path = $this->getMountPoint();
- }
$source = $this->getSourcePath($path);
if ($source) {
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
@@ -497,7 +481,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief return mount point of share, relative to data/user/files
+ * return mount point of share, relative to data/user/files
* @return string
*/
public function getMountPoint() {
@@ -505,7 +489,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief get share type
+ * get share type
* @return integer can be single user share (0) group share (1), unique group share name (2)
*/
private function getShareType() {
@@ -517,7 +501,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief does the group share already has a user specific unique name
+ * does the group share already has a user specific unique name
* @return bool
*/
private function uniqueNameSet() {
@@ -525,14 +509,14 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief the share now uses a unique name of this user
+ * the share now uses a unique name of this user
*/
private function setUniqueName() {
$this->share['unique_name'] = true;
}
/**
- * @brief get share ID
+ * get share ID
* @return integer unique share ID
*/
private function getShareId() {
@@ -540,7 +524,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief get the user who shared the file
+ * get the user who shared the file
* @return string
*/
public function getSharedFrom() {
@@ -548,7 +532,7 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief return share type, can be "file" or "folder"
+ * return share type, can be "file" or "folder"
* @return string
*/
public function getItemType() {