Adding common name to sharee

This commit is contained in:
Thomas Müller 2016-02-05 17:30:16 +01:00 committed by Lukas Reschke
parent 5b86148d3a
commit c1ae8b0d81
3 changed files with 7 additions and 4 deletions

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');
}
/**

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');
}
/**

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']