Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps/dav
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-10-16 15:39:04 +0300
committerGeorg Ehrke <developer@georgehrke.com>2018-10-22 16:48:13 +0300
commit325e366b581372b9f07a4bd00b7f874283c9f1f5 (patch)
tree251775ea595d40a4f52faaa2c2088d737fc9353d /apps/dav
parentf737ae719de2e2af534bce03a8920bbb96aa8700 (diff)
add correct calendar-user-type to resource and room backend
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php12
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php2
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php7
-rw-r--r--apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php1
-rw-r--r--apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php1
6 files changed, 21 insertions, 4 deletions
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
index dcd393b512e..d658c3433f2 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
@@ -50,6 +50,9 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
/** @var string */
private $dbTableName;
+ /** @var string */
+ private $cuType;
+
/**
* @param IDBConnection $dbConnection
* @param IUserSession $userSession
@@ -57,18 +60,22 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
* @param ILogger $logger
* @param string $principalPrefix
* @param string $dbPrefix
+ * @param string $cuType
*/
public function __construct(IDBConnection $dbConnection,
IUserSession $userSession,
IGroupManager $groupManager,
ILogger $logger,
- $principalPrefix, $dbPrefix) {
+ string $principalPrefix,
+ string $dbPrefix,
+ string $cuType) {
$this->db = $dbConnection;
$this->userSession = $userSession;
$this->groupManager = $groupManager;
$this->logger = $logger;
$this->principalPrefix = $principalPrefix;
$this->dbTableName = 'calendar_' . $dbPrefix;
+ $this->cuType = $cuType;
}
/**
@@ -328,7 +335,8 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
return [
'uri' => $this->principalPrefix . '/' . $row['backend_id'] . '-' . $row['resource_id'],
'{DAV:}displayname' => $row['displayname'],
- '{http://sabredav.org/ns}email-address' => $row['email']
+ '{http://sabredav.org/ns}email-address' => $row['email'],
+ '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => $this->cuType,
];
}
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php
index a1030376c11..f8f10e78f94 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php
@@ -40,6 +40,6 @@ class ResourcePrincipalBackend extends AbstractPrincipalBackend {
IGroupManager $groupManager,
ILogger $logger) {
parent::__construct($dbConnection, $userSession, $groupManager, $logger,
- 'principals/calendar-resources', 'resources');
+ 'principals/calendar-resources', 'resources', 'RESOURCE');
}
}
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php
index 1d22299515f..3059ed80ea6 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php
@@ -40,6 +40,6 @@ class RoomPrincipalBackend extends AbstractPrincipalBackend {
IGroupManager $groupManager,
ILogger $logger) {
parent::__construct($dbConnection, $userSession, $groupManager, $logger,
- 'principals/calendar-rooms', 'rooms');
+ 'principals/calendar-rooms', 'rooms', 'ROOM');
}
}
diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
index 4dee0220fc8..aca36fb77ea 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
@@ -53,6 +53,9 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
/** @var string */
protected $principalPrefix;
+ /** @var string */
+ protected $expectedCUType;
+
public function setUp() {
parent::setUp();
@@ -127,16 +130,19 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
'uri' => $this->principalPrefix . '/db-123',
'{DAV:}displayname' => 'Resource 123',
'{http://sabredav.org/ns}email-address' => 'foo@bar.com',
+ '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => $this->expectedCUType,
],
[
'uri' => $this->principalPrefix . '/ldap-123',
'{DAV:}displayname' => 'Resource 123 ldap',
'{http://sabredav.org/ns}email-address' => 'ldap@bar.com',
+ '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => $this->expectedCUType,
],
[
'uri' => $this->principalPrefix . '/db-456',
'{DAV:}displayname' => 'Resource 456',
'{http://sabredav.org/ns}email-address' => 'bli@bar.com',
+ '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => $this->expectedCUType,
],
], $actual);
@@ -209,6 +215,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
'uri' => $this->principalPrefix . '/db-123',
'{DAV:}displayname' => 'Resource 123',
'{http://sabredav.org/ns}email-address' => 'foo@bar.com',
+ '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => $this->expectedCUType,
], $actual);
}
diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php
index 90db4bb4b7b..d3c774417c0 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php
@@ -31,5 +31,6 @@ Class ResourcePrincipalBackendTest extends AbstractPrincipalBackendTest {
$this->userSession, $this->groupManager, $this->logger);
$this->expectedDbTable = 'calendar_resources';
$this->principalPrefix = 'principals/calendar-resources';
+ $this->expectedCUType = 'RESOURCE';
}
}
diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php
index b55c6ddceb6..a10aaa26b35 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php
@@ -31,5 +31,6 @@ Class RoomPrincipalBackendTest extends AbstractPrincipalBackendTest {
$this->userSession, $this->groupManager, $this->logger);
$this->expectedDbTable = 'calendar_rooms';
$this->principalPrefix = 'principals/calendar-rooms';
+ $this->expectedCUType = 'ROOM';
}
}