]> source.dussan.org Git - nextcloud-server.git/commitdiff
Adding common name to sharee
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 5 Feb 2016 16:30:16 +0000 (17:30 +0100)
committerLukas Reschke <lukas@owncloud.com>
Mon, 8 Feb 2016 10:36:57 +0000 (11:36 +0100)
apps/dav/lib/caldav/caldavbackend.php
apps/dav/lib/carddav/carddavbackend.php
apps/dav/lib/dav/sharing/backend.php

index 35f3ee983fdd7e7ad2e8c7f53d054130435b7df1..52b4812b05b8a22bd20ae789216cc55cfd69af0d 100644 (file)
@@ -106,7 +106,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
        public function __construct(\OCP\IDBConnection $db, Principal $principalBackend) {
                $this->db = $db;
                $this->principalBackend = $principalBackend;
-               $this->sharingBackend = new Backend($this->db, 'calendar');
+               $this->sharingBackend = new Backend($this->db, $principalBackend, 'calendar');
        }
 
        /**
index ef523ca88969ce5e522051303ff5803b2fa9098a..2c1960fbb9d1d504e8a2d2169e8540bf4d1dcaf1 100644 (file)
@@ -72,7 +72,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
        public function __construct(IDBConnection $db, Principal $principalBackend) {
                $this->db = $db;
                $this->principalBackend = $principalBackend;
-               $this->sharingBackend = new Backend($this->db, 'addressbook');
+               $this->sharingBackend = new Backend($this->db, $principalBackend, 'addressbook');
        }
 
        /**
index 0b28891fbc4bbaced95ab2a81b3e1872cdba1820..4794049184222af3948cdfaed0a9bd7e8db32aac 100644 (file)
@@ -24,6 +24,7 @@
 
 namespace OCA\DAV\DAV\Sharing;
 
+use OCA\DAV\Connector\Sabre\Principal;
 use OCP\IDBConnection;
 
 class Backend {
@@ -43,8 +44,9 @@ class Backend {
         *
         * @param IDBConnection $db
         */
-       public function __construct(IDBConnection $db, $resourceType) {
+       public function __construct(IDBConnection $db, Principal $principalBackend, $resourceType) {
                $this->db = $db;
+               $this->principalBackend = $principalBackend;
                $this->resourceType = $resourceType;
        }
 
@@ -153,9 +155,10 @@ class Backend {
 
                $shares = [];
                while($row = $result->fetch()) {
+                       $p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
                        $shares[]= [
                                'href' => "principal:${row['principaluri']}",
-//                             'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
+                               'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
                                'status' => 1,
                                'readOnly' => ($row['access'] == self::ACCESS_READ),
                                '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal' => $row['principaluri']