summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-10 14:22:18 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-10 14:22:18 +0100
commitc1d21cf873f14361a30b3473ebd8c8130b0656a5 (patch)
tree43097e82c6e722629f470679fc180255f3f4183e /apps/dav/lib
parent63b99b614c53c903148f4a7ff0c02ca625aa9890 (diff)
parent2e94d34dfd99378bfaa39243a265a55a1b8038ba (diff)
downloadnextcloud-server-c1d21cf873f14361a30b3473ebd8c8130b0656a5.tar.gz
nextcloud-server-c1d21cf873f14361a30b3473ebd8c8130b0656a5.zip
Merge pull request #22263 from owncloud/fix-group-principals
Fix group principal
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/connector/sabre/principal.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/dav/lib/connector/sabre/principal.php b/apps/dav/lib/connector/sabre/principal.php
index 4f26390e3cc..a573124007d 100644
--- a/apps/dav/lib/connector/sabre/principal.php
+++ b/apps/dav/lib/connector/sabre/principal.php
@@ -49,6 +49,9 @@ class Principal implements BackendInterface {
/** @var string */
private $principalPrefix;
+ /** @var bool */
+ private $hasGroups;
+
/**
* @param IUserManager $userManager
* @param IGroupManager $groupManager
@@ -60,6 +63,7 @@ class Principal implements BackendInterface {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->principalPrefix = trim($principalPrefix, '/');
+ $this->hasGroups = ($principalPrefix === 'principals/users/');
}
/**
@@ -141,13 +145,15 @@ class Principal implements BackendInterface {
throw new Exception('Principal not found');
}
- $groups = $this->groupManager->getUserGroups($user);
- $groups = array_map(function($group) {
- /** @var IGroup $group */
- return $this->principalPrefix . '/' . $group->getGID();
- }, $groups);
+ if ($this->hasGroups) {
+ $groups = $this->groupManager->getUserGroups($user);
+ $groups = array_map(function($group) {
+ /** @var IGroup $group */
+ return 'principals/groups/' . $group->getGID();
+ }, $groups);
- return $groups;
+ return $groups;
+ }
}
return [];
}