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');
}
/**
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');
}
/**
namespace OCA\DAV\DAV\Sharing;
+use OCA\DAV\Connector\Sabre\Principal;
use OCP\IDBConnection;
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;
}
$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']