diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-24 12:47:18 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-24 12:47:18 +0100 |
commit | 3d51682440f90523294ee9f5b94e832e29c8eb5e (patch) | |
tree | 8521ddccd7868961fe8426c74243bcfec599263d /apps/dav/lib/connector | |
parent | 789df4d63041d5ffb46f71e33172dd42450b4bc8 (diff) | |
parent | 06e8c70400dd6e3e1c153c4258eba0357c502a7f (diff) | |
download | nextcloud-server-3d51682440f90523294ee9f5b94e832e29c8eb5e.tar.gz nextcloud-server-3d51682440f90523294ee9f5b94e832e29c8eb5e.zip |
Merge pull request #23342 from owncloud/fix-group-sharing-for-v1-caldav-and-carddav
Fix group shares on v1 caldav and carddav
Diffstat (limited to 'apps/dav/lib/connector')
-rw-r--r-- | apps/dav/lib/connector/legacydavacl.php | 15 | ||||
-rw-r--r-- | apps/dav/lib/connector/sabre/principal.php | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/apps/dav/lib/connector/legacydavacl.php b/apps/dav/lib/connector/legacydavacl.php index 07aefa1b863..eb6ca1fd7d5 100644 --- a/apps/dav/lib/connector/legacydavacl.php +++ b/apps/dav/lib/connector/legacydavacl.php @@ -23,7 +23,10 @@ namespace OCA\DAV\Connector; use OCA\DAV\Connector\Sabre\DavAclPlugin; +use Sabre\DAV\INode; +use Sabre\DAV\PropFind; use Sabre\HTTP\URLUtil; +use Sabre\DAVACL\Xml\Property\Principal; class LegacyDAVACL extends DavAclPlugin { @@ -67,4 +70,16 @@ class LegacyDAVACL extends DavAclPlugin { } return "principals/$name"; } + + function propFind(PropFind $propFind, INode $node) { + /* Overload current-user-principal */ + $propFind->handle('{DAV:}current-user-principal', function () { + if ($url = parent::getCurrentUserPrincipal()) { + return new Principal(Principal::HREF, $url . '/'); + } else { + return new Principal(Principal::UNAUTHENTICATED); + } + }); + parent::propFind($propFind, $node); + } } diff --git a/apps/dav/lib/connector/sabre/principal.php b/apps/dav/lib/connector/sabre/principal.php index 31de4e5bad1..18f28a916f1 100644 --- a/apps/dav/lib/connector/sabre/principal.php +++ b/apps/dav/lib/connector/sabre/principal.php @@ -132,10 +132,11 @@ class Principal implements BackendInterface { * Returns the list of groups a principal is a member of * * @param string $principal + * @param bool $needGroups * @return array * @throws Exception */ - public function getGroupMembership($principal) { + public function getGroupMembership($principal, $needGroups = false) { list($prefix, $name) = URLUtil::splitPath($principal); if ($prefix === $this->principalPrefix) { @@ -144,7 +145,7 @@ class Principal implements BackendInterface { throw new Exception('Principal not found'); } - if ($this->hasGroups) { + if ($this->hasGroups || $needGroups) { $groups = $this->groupManager->getUserGroups($user); $groups = array_map(function($group) { /** @var IGroup $group */ |