Merge pull request #21833 from owncloud/use-proper-shared-uri-for-contacts
Reassemble behavior on shared address books with respect to uri and d…
This commit is contained in:
commit
6deb553dc2
4 changed files with 11 additions and 12 deletions
|
@ -655,10 +655,6 @@ CREATE TABLE calendarobjects (
|
|||
<unsigned>true</unsigned>
|
||||
<length>11</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>uri</name>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>principaluri</name>
|
||||
<type>text</type>
|
||||
|
@ -685,7 +681,7 @@ CREATE TABLE calendarobjects (
|
|||
<name>principaluri</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>uri</name>
|
||||
<name>resourceid</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>type</name>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<description>ownCloud WebDAV endpoint</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>owncloud.org</author>
|
||||
<version>0.1.3</version>
|
||||
<version>0.1.4</version>
|
||||
<standalone/>
|
||||
<default_enable/>
|
||||
<types>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
namespace OCA\DAV\CardDAV;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use OCA\DAV\Connector\Sabre\Principal;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IDBConnection;
|
||||
|
@ -31,6 +32,7 @@ use Sabre\CardDAV\Backend\BackendInterface;
|
|||
use Sabre\CardDAV\Backend\SyncSupport;
|
||||
use Sabre\CardDAV\Plugin;
|
||||
use Sabre\DAV\Exception\BadRequest;
|
||||
use Sabre\HTTP\URLUtil;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
use Sabre\VObject\Reader;
|
||||
|
||||
|
@ -113,7 +115,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$principals[]= $principalUri;
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.uri', 's.access'])
|
||||
$result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access'])
|
||||
->from('dav_shares', 's')
|
||||
->join('s', 'addressbooks', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
|
||||
->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri')))
|
||||
|
@ -123,11 +125,14 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
->execute();
|
||||
|
||||
while($row = $result->fetch()) {
|
||||
list(, $name) = URLUtil::splitPath($row['principaluri']);
|
||||
$uri = $row['uri'] . '_shared_by_' . $name;
|
||||
$displayName = $row['displayname'] . "($name)";
|
||||
$addressBooks[] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'uri' => $uri,
|
||||
'principaluri' => $principalUri,
|
||||
'{DAV:}displayname' => $row['displayname'],
|
||||
'{DAV:}displayname' => $displayName,
|
||||
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
|
||||
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
|
||||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
||||
|
@ -826,12 +831,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$access = $element['readOnly'] ? self::ACCESS_READ : self::ACCESS_READ_WRITE;
|
||||
}
|
||||
|
||||
$newUri = sha1($addressBook->getName() . $addressBook->getOwner());
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->insert('dav_shares')
|
||||
->values([
|
||||
'principaluri' => $query->createNamedParameter($parts[1]),
|
||||
'uri' => $query->createNamedParameter($newUri),
|
||||
'type' => $query->createNamedParameter('addressbook'),
|
||||
'access' => $query->createNamedParameter($access),
|
||||
'resourceid' => $query->createNamedParameter($addressBook->getBookId())
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<callback>xmlElementMatch</callback>
|
||||
<arg>
|
||||
<name>parent</name>
|
||||
<value>$multistatus-response-prefix:[^{DAV:}href=$addressbookhome2:/ade1a55d408167e8ff77611c0eebe8f80579b549/]</value>
|
||||
<value>$multistatus-response-prefix:[^{DAV:}href=$addressbookhome2:/addressbook_shared_by_user01/]</value>
|
||||
</arg>
|
||||
<arg>
|
||||
<name>exists</name>
|
||||
|
|
Loading…
Reference in a new issue