Skip to content
Snippets Groups Projects
Unverified Commit c23a66cd authored by Georg Ehrke's avatar Georg Ehrke
Browse files

fixes dav share issue with owner

parent 1783fa71
No related branches found
No related tags found
No related merge requests found
...@@ -139,6 +139,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { ...@@ -139,6 +139,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
]; ];
} }
if (!$this->isShared()) {
return $acl;
}
if ($this->getOwner() !== parent::getOwner()) { if ($this->getOwner() !== parent::getOwner()) {
$acl[] = [ $acl[] = [
'privilege' => '{DAV:}read', 'privilege' => '{DAV:}read',
...@@ -168,14 +172,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { ...@@ -168,14 +172,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
} }
$acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl); $acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl);
if (!$this->isShared()) {
return $acl;
}
$allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/public']; $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/public'];
return array_filter($acl, function($rule) use ($allowedPrincipals) { return array_filter($acl, function($rule) use ($allowedPrincipals) {
return in_array($rule['principal'], $allowedPrincipals); return \in_array($rule['principal'], $allowedPrincipals, true);
}); });
} }
......
...@@ -105,12 +105,17 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { ...@@ -105,12 +105,17 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
'privilege' => '{DAV:}read', 'privilege' => '{DAV:}read',
'principal' => $this->getOwner(), 'principal' => $this->getOwner(),
'protected' => true, 'protected' => true,
]]; ],[
$acl[] = [
'privilege' => '{DAV:}write', 'privilege' => '{DAV:}write',
'principal' => $this->getOwner(), 'principal' => $this->getOwner(),
'protected' => true, 'protected' => true,
]; ]
];
if (!$this->isShared()) {
return $acl;
}
if ($this->getOwner() !== parent::getOwner()) { if ($this->getOwner() !== parent::getOwner()) {
$acl[] = [ $acl[] = [
'privilege' => '{DAV:}read', 'privilege' => '{DAV:}read',
...@@ -133,11 +138,11 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { ...@@ -133,11 +138,11 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
]; ];
} }
if ($this->isShared()) { $acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl);
return $acl; $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system'];
} return array_filter($acl, function($rule) use ($allowedPrincipals) {
return \in_array($rule['principal'], $allowedPrincipals, true);
return $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); });
} }
public function getChildACL() { public function getChildACL() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment