summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-08-29 23:45:02 +0200
committerVincent Petry <pvince81@owncloud.com>2013-09-13 19:59:15 +0200
commit364e7991a42c92affb9085082ff79f6b653de6dd (patch)
treeb35f0e1c85a7e992f43a4710eb702ac046f322b2 /apps/files/lib
parent4549cf519e838a2dd2828453c4157231bccd3287 (diff)
downloadnextcloud-server-364e7991a42c92affb9085082ff79f6b653de6dd.tar.gz
nextcloud-server-364e7991a42c92affb9085082ff79f6b653de6dd.zip
Fixed ajax support to also update the current dir permissions
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/helper.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php
index 282f0678a9a..3c13b8ea6e2 100644
--- a/apps/files/lib/helper.php
+++ b/apps/files/lib/helper.php
@@ -111,4 +111,26 @@ class Helper
}
return $breadcrumb;
}
+
+ /**
+ * Returns the numeric permissions for the given directory.
+ * @param string $dir directory without trailing slash
+ * @return numeric permissions
+ */
+ public static function getDirPermissions($dir){
+ $permissions = \OCP\PERMISSION_READ;
+ if (\OC\Files\Filesystem::isCreatable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_CREATE;
+ }
+ if (\OC\Files\Filesystem::isUpdatable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_UPDATE;
+ }
+ if (\OC\Files\Filesystem::isDeletable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_DELETE;
+ }
+ if (\OC\Files\Filesystem::isSharable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_SHARE;
+ }
+ return $permissions;
+ }
}