summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-21 16:20:52 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-26 15:07:50 +0100
commit7b678a8c1702aaf4bfdbb0df598b8a83e383484e (patch)
treecf8443d39e36e1b295572af90f5bd671342d2178 /apps
parent3da78c8f1c9355a726f289e834fa237366c3df20 (diff)
downloadnextcloud-server-7b678a8c1702aaf4bfdbb0df598b8a83e383484e.tar.gz
nextcloud-server-7b678a8c1702aaf4bfdbb0df598b8a83e383484e.zip
Reassemble behavior on shared address books with respect to uri and displayname
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/appinfo/database.xml6
-rw-r--r--apps/dav/appinfo/info.xml2
-rw-r--r--apps/dav/lib/carddav/carddavbackend.php13
-rw-r--r--apps/dav/tests/travis/caldavtest/tests/CardDAV/sharing-addressbooks.xml2
4 files changed, 11 insertions, 12 deletions
diff --git a/apps/dav/appinfo/database.xml b/apps/dav/appinfo/database.xml
index 50c8aa7d8ca..4221e590fa5 100644
--- a/apps/dav/appinfo/database.xml
+++ b/apps/dav/appinfo/database.xml
@@ -656,10 +656,6 @@ CREATE TABLE calendarobjects (
<length>11</length>
</field>
<field>
- <name>uri</name>
- <type>text</type>
- </field>
- <field>
<name>principaluri</name>
<type>text</type>
</field>
@@ -685,7 +681,7 @@ CREATE TABLE calendarobjects (
<name>principaluri</name>
</field>
<field>
- <name>uri</name>
+ <name>resourceid</name>
</field>
<field>
<name>type</name>
diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml
index d9eefaefcf1..3a38feab59e 100644
--- a/apps/dav/appinfo/info.xml
+++ b/apps/dav/appinfo/info.xml
@@ -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>
diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php
index 44164e61259..28f6099b639 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -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())
diff --git a/apps/dav/tests/travis/caldavtest/tests/CardDAV/sharing-addressbooks.xml b/apps/dav/tests/travis/caldavtest/tests/CardDAV/sharing-addressbooks.xml
index 046c3d59dbd..37b4941b9f1 100644
--- a/apps/dav/tests/travis/caldavtest/tests/CardDAV/sharing-addressbooks.xml
+++ b/apps/dav/tests/travis/caldavtest/tests/CardDAV/sharing-addressbooks.xml
@@ -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>