Merge pull request #12459 from nextcloud/bugfix-stable14/dav_shares_hickup
[stable14] fixes dav share issue with owner
This commit is contained in:
commit
7781485fb7
|
@ -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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
$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 {
|
||||||
'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 {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
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() {
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<description>Shared calendar exists</description>
|
<description>Shared calendar exists</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PROPFIND</method>
|
<method>PROPFIND</method>
|
||||||
<ruri>$calendarhome1:/shared/</ruri>
|
<ruri>$calendarhome2:/shared_shared_by_user01/</ruri>
|
||||||
<header>
|
<header>
|
||||||
<name>Depth</name>
|
<name>Depth</name>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
<description>Sharee creates event</description>
|
<description>Sharee creates event</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PUT</method>
|
<method>PUT</method>
|
||||||
<ruri>$calendarhome1:/shared/1.ics</ruri>
|
<ruri>$calendarhome2:/shared_shared_by_user01/1.ics</ruri>
|
||||||
<data>
|
<data>
|
||||||
<content-type>text/calendar; charset=utf-8</content-type>
|
<content-type>text/calendar; charset=utf-8</content-type>
|
||||||
<filepath>Resource/CalDAV/sharing/calendars/read-write/5.ics</filepath>
|
<filepath>Resource/CalDAV/sharing/calendars/read-write/5.ics</filepath>
|
||||||
|
@ -235,7 +235,7 @@
|
||||||
<description>Sharee sees changed event</description>
|
<description>Sharee sees changed event</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>GET</method>
|
<method>GET</method>
|
||||||
<ruri>$calendarhome1:/shared/1.ics</ruri>
|
<ruri>$calendarhome2:/shared_shared_by_user01/1.ics</ruri>
|
||||||
<verify>
|
<verify>
|
||||||
<callback>calendarDataMatch</callback>
|
<callback>calendarDataMatch</callback>
|
||||||
<arg>
|
<arg>
|
||||||
|
@ -263,7 +263,7 @@
|
||||||
<description>Sharee sees new event</description>
|
<description>Sharee sees new event</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>GET</method>
|
<method>GET</method>
|
||||||
<ruri>$calendarhome1:/shared/2.ics</ruri>
|
<ruri>$calendarhome2:/shared_shared_by_user01/2.ics</ruri>
|
||||||
<verify>
|
<verify>
|
||||||
<callback>calendarDataMatch</callback>
|
<callback>calendarDataMatch</callback>
|
||||||
<arg>
|
<arg>
|
||||||
|
@ -277,7 +277,7 @@
|
||||||
<description>Sharee changes event</description>
|
<description>Sharee changes event</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PUT</method>
|
<method>PUT</method>
|
||||||
<ruri>$calendarhome1:/shared/2.ics</ruri>
|
<ruri>$calendarhome2:/shared_shared_by_user01/2.ics</ruri>
|
||||||
<data>
|
<data>
|
||||||
<content-type>text/calendar; charset=utf-8</content-type>
|
<content-type>text/calendar; charset=utf-8</content-type>
|
||||||
<filepath>Resource/CalDAV/sharing/calendars/read-write/8.ics</filepath>
|
<filepath>Resource/CalDAV/sharing/calendars/read-write/8.ics</filepath>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<description>POST invitation</description>
|
<description>POST invitation</description>
|
||||||
<request>
|
<request>
|
||||||
<method>POST</method>
|
<method>POST</method>
|
||||||
<ruri>$addressbookpath1:</ruri>
|
<ruri>$addressbookhome1:/addressbook/</ruri>
|
||||||
<data>
|
<data>
|
||||||
<content-type>text/xml; charset=utf-8</content-type>
|
<content-type>text/xml; charset=utf-8</content-type>
|
||||||
<filepath>Resource/CardDAV/sharing/read-write/1.xml</filepath>
|
<filepath>Resource/CardDAV/sharing/read-write/1.xml</filepath>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<description>Shared addressbook exists</description>
|
<description>Shared addressbook exists</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PROPFIND</method>
|
<method>PROPFIND</method>
|
||||||
<ruri>$addressbookpath1:/</ruri>
|
<ruri>$addressbookhome2:/addressbook_shared_by_user01/</ruri>
|
||||||
<header>
|
<header>
|
||||||
<name>Depth</name>
|
<name>Depth</name>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
</test>
|
</test>
|
||||||
|
|
||||||
<test name='4a'>
|
<test name='4a'>
|
||||||
<description>Shared calendar exists Depth:1</description>
|
<description>Shared addressbook exists Depth:1</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PROPFIND</method>
|
<method>PROPFIND</method>
|
||||||
<ruri>$addressbookhome2:/</ruri>
|
<ruri>$addressbookhome2:/</ruri>
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
</test>
|
</test>
|
||||||
|
|
||||||
<test name='5'>
|
<test name='5'>
|
||||||
<description>Original calendar unchanged</description>
|
<description>Original addressbook unchanged</description>
|
||||||
<request>
|
<request>
|
||||||
<method>PROPFIND</method>
|
<method>PROPFIND</method>
|
||||||
<ruri>$addressbookpath1:</ruri>
|
<ruri>$addressbookpath1:</ruri>
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
<description>Sharee creates contact</description>
|
<description>Sharee creates contact</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PUT</method>
|
<method>PUT</method>
|
||||||
<ruri>$addressbookpath1:/1.vcf</ruri>
|
<ruri>$addressbookhome2:/addressbook_shared_by_user01/1.vcf</ruri>
|
||||||
<data>
|
<data>
|
||||||
<content-type>text/vcard; charset=utf-8</content-type>
|
<content-type>text/vcard; charset=utf-8</content-type>
|
||||||
<filepath>Resource/CardDAV/sharing/read-write/6.vcf</filepath>
|
<filepath>Resource/CardDAV/sharing/read-write/6.vcf</filepath>
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
<description>Sharee sees changed contact</description>
|
<description>Sharee sees changed contact</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>GET</method>
|
<method>GET</method>
|
||||||
<ruri>$addressbookpath1:/1.vcf</ruri>
|
<ruri>$addressbookhome2:/addressbook_shared_by_user01/1.vcf</ruri>
|
||||||
<verify>
|
<verify>
|
||||||
<callback>addressDataMatch</callback>
|
<callback>addressDataMatch</callback>
|
||||||
<arg>
|
<arg>
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
</test>
|
</test>
|
||||||
|
|
||||||
<test name='10'>
|
<test name='10'>
|
||||||
<description>Sharer creates event</description>
|
<description>Sharer creates contact</description>
|
||||||
<request>
|
<request>
|
||||||
<method>PUT</method>
|
<method>PUT</method>
|
||||||
<ruri>$addressbookpath1:/2.vcf</ruri>
|
<ruri>$addressbookpath1:/2.vcf</ruri>
|
||||||
|
@ -197,10 +197,10 @@
|
||||||
</request>
|
</request>
|
||||||
</test>
|
</test>
|
||||||
<test name='11'>
|
<test name='11'>
|
||||||
<description>Sharee sees new event</description>
|
<description>Sharee sees new contact</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>GET</method>
|
<method>GET</method>
|
||||||
<ruri>$addressbookpath1:/2.vcf</ruri>
|
<ruri>$addressbookhome2:/addressbook_shared_by_user01/2.vcf</ruri>
|
||||||
<verify>
|
<verify>
|
||||||
<callback>addressDataMatch</callback>
|
<callback>addressDataMatch</callback>
|
||||||
<arg>
|
<arg>
|
||||||
|
@ -211,10 +211,10 @@
|
||||||
</request>
|
</request>
|
||||||
</test>
|
</test>
|
||||||
<test name='12'>
|
<test name='12'>
|
||||||
<description>Sharee changes event</description>
|
<description>Sharee changes contact</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PUT</method>
|
<method>PUT</method>
|
||||||
<ruri>$addressbookpath1:/2.vcf</ruri>
|
<ruri>$addressbookhome2:/addressbook_shared_by_user01/2.vcf</ruri>
|
||||||
<data>
|
<data>
|
||||||
<content-type>text/vcard; charset=utf-8</content-type>
|
<content-type>text/vcard; charset=utf-8</content-type>
|
||||||
<filepath>Resource/CardDAV/sharing/read-write/9.vcf</filepath>
|
<filepath>Resource/CardDAV/sharing/read-write/9.vcf</filepath>
|
||||||
|
@ -225,7 +225,7 @@
|
||||||
</request>
|
</request>
|
||||||
</test>
|
</test>
|
||||||
<test name='13'>
|
<test name='13'>
|
||||||
<description>Sharer sees changed event</description>
|
<description>Sharer sees changed contact</description>
|
||||||
<request>
|
<request>
|
||||||
<method>GET</method>
|
<method>GET</method>
|
||||||
<ruri>$addressbookpath1:/2.vcf</ruri>
|
<ruri>$addressbookpath1:/2.vcf</ruri>
|
||||||
|
@ -281,7 +281,7 @@
|
||||||
</verify> </request>
|
</verify> </request>
|
||||||
</test>
|
</test>
|
||||||
<test name='16'>
|
<test name='16'>
|
||||||
<description>Shared calendar no longer exists Depth:1</description>
|
<description>Shared addressbook no longer exists Depth:1</description>
|
||||||
<request user="$userid2:" pswd="$pswd2:">
|
<request user="$userid2:" pswd="$pswd2:">
|
||||||
<method>PROPFIND</method>
|
<method>PROPFIND</method>
|
||||||
<ruri>$addressbookhome2:</ruri>
|
<ruri>$addressbookhome2:</ruri>
|
||||||
|
|
Loading…
Reference in New Issue