summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-01-24 15:54:40 +0100
committerRobin Appelman <icewind@owncloud.com>2014-01-24 15:54:40 +0100
commitfc5f20112efe03b203978c4b1045ed70c2ce5e74 (patch)
tree3d40c55cf53b472c90b81fef4ef60426e408f40b /lib/private/files
parent3971b12768ebe4fb410724a127173c38639c0a97 (diff)
downloadnextcloud-server-fc5f20112efe03b203978c4b1045ed70c2ce5e74.tar.gz
nextcloud-server-fc5f20112efe03b203978c4b1045ed70c2ce5e74.zip
Add isReadable, isUpdateable, isDeletable, isShareable
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/fileinfo.php38
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index b80873d1d00..7edea13df96 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -122,7 +122,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess, \JsonSerializable {
/**
* @return int
*/
- public function getMtime() {
+ public function getMTime() {
return $this->data['mtime'];
}
@@ -150,4 +150,40 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess, \JsonSerializable {
public function getData(){
return $this->data;
}
+
+ /**
+ * @param int $permissions
+ * @return bool
+ */
+ protected function checkPermissions($permissions) {
+ return ($this->getPermissions() & $permissions) === $permissions;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isReadable() {
+ return $this->checkPermissions(\OCP\PERMISSION_READ);
+ }
+
+ /**
+ * @return bool
+ */
+ public function isUpdateable() {
+ return $this->checkPermissions(\OCP\PERMISSION_UPDATE);
+ }
+
+ /**
+ * @return bool
+ */
+ public function isDeletable() {
+ return $this->checkPermissions(\OCP\PERMISSION_DELETE);
+ }
+
+ /**
+ * @return bool
+ */
+ public function isShareable() {
+ return $this->checkPermissions(\OCP\PERMISSION_SHARE);
+ }
}