Browse Source

Adding common name to sharee

tags/v9.0beta1
Thomas Müller 8 years ago
parent
commit
c1ae8b0d81

+ 1
- 1
apps/dav/lib/caldav/caldavbackend.php View 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');
}

/**

+ 1
- 1
apps/dav/lib/carddav/carddavbackend.php View 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');
}

/**

+ 5
- 2
apps/dav/lib/dav/sharing/backend.php View 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']

Loading…
Cancel
Save