Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes dav share issue with owner #12458

Merged
merged 2 commits into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions apps/dav/lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public function getACL() {
];
}

if (!$this->isShared()) {
return $acl;
}

if ($this->getOwner() !== parent::getOwner()) {
$acl[] = [
'privilege' => '{DAV:}read',
Expand Down Expand Up @@ -168,14 +172,9 @@ public function getACL() {
}

$acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl);

if (!$this->isShared()) {
return $acl;
}

$allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/public'];
return array_filter($acl, function($rule) use ($allowedPrincipals) {
return in_array($rule['principal'], $allowedPrincipals);
return \in_array($rule['principal'], $allowedPrincipals, true);
});
}

Expand Down
21 changes: 13 additions & 8 deletions apps/dav/lib/CardDAV/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,17 @@ public function getACL() {
'privilege' => '{DAV:}read',
'principal' => $this->getOwner(),
'protected' => true,
]];
$acl[] = [
],[
'privilege' => '{DAV:}write',
'principal' => $this->getOwner(),
'protected' => true,
];
]
];

if (!$this->isShared()) {
return $acl;
}

if ($this->getOwner() !== parent::getOwner()) {
$acl[] = [
'privilege' => '{DAV:}read',
Expand All @@ -133,11 +138,11 @@ public function getACL() {
];
}

if ($this->isShared()) {
return $acl;
}

return $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl);
$acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl);
$allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system'];
return array_filter($acl, function($rule) use ($allowedPrincipals) {
return \in_array($rule['principal'], $allowedPrincipals, true);
});
}

public function getChildACL() {
Expand Down