[Pkg-owncloud-commits] [owncloud] 58/70: fix detection of system wide mount points
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:40:11 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v6.0.5RC1
in repository owncloud.
commit 74a994c56119210ced51ff34a8ba775e76562a2f
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Tue Aug 5 15:25:52 2014 +0200
fix detection of system wide mount points
---
apps/files_encryption/lib/util.php | 43 ++++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index a0d2f5a..22649fd 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1213,10 +1213,10 @@ class Util {
// check if it is a group mount
if (\OCP\App::isEnabled("files_external")) {
- $mount = \OC_Mount_Config::getSystemMountPoints();
- foreach ($mount as $mountPoint => $data) {
- if ($mountPoint == substr($ownerPath, 1, strlen($mountPoint))) {
- $userIds = array_merge($userIds, $this->getUserWithAccessToMountPoint($data['applicable']['users'], $data['applicable']['groups']));
+ $mounts = \OC_Mount_Config::getSystemMountPoints();
+ foreach ($mounts as $mount) {
+ if ($mount['mountpoint'] == substr($ownerPath, 1, strlen($mount['mountpoint']))) {
+ $userIds = array_merge($userIds, $this->getUserWithAccessToMountPoint($mount['applicable']['users'], $mount['applicable']['groups']));
}
}
}
@@ -1775,10 +1775,12 @@ class Util {
public function isSystemWideMountPoint($path) {
$normalizedPath = ltrim($path, '/');
if (\OCP\App::isEnabled("files_external")) {
- $mount = \OC_Mount_Config::getSystemMountPoints();
- foreach ($mount as $mountPoint => $data) {
- if ($mountPoint == substr($normalizedPath, 0, strlen($mountPoint))) {
- return true;
+ $mounts = \OC_Mount_Config::getSystemMountPoints();
+ foreach ($mounts as $mount) {
+ if ($mount['mountpoint'] == substr($normalizedPath, 0, strlen($mount['mountpoint']))) {
+ if ($this->isMountPointApplicableToUser($mount)) {
+ return true;
+ }
}
}
}
@@ -1786,7 +1788,30 @@ class Util {
}
/**
- * @brief decrypt private key and add it to the current session
+ * check if mount point is applicable to user
+ *
+ * @param array $mount contains $mount['applicable']['users'], $mount['applicable']['groups']
+ * @return boolean
+ */
+ protected function isMountPointApplicableToUser($mount) {
+ $uid = \OCP\User::getUser();
+ $acceptedUids = array('all', $uid);
+ // check if mount point is applicable for the user
+ $intersection = array_intersect($acceptedUids, $mount['applicable']['users']);
+ if (!empty($intersection)) {
+ return true;
+ }
+ // check if mount point is applicable for group where the user is a member
+ foreach ($mount['applicable']['groups'] as $gid) {
+ if (\OC_Group::inGroup($uid, $gid)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * decrypt private key and add it to the current session
* @param array $params with 'uid' and 'password'
* @return mixed session or false
*/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list