Browse Source

add correct calendar-user-type to resource and room backend

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
tags/v15.0.0beta1
Georg Ehrke 5 years ago
parent
commit
325e366b58
No account linked to committer's email address

+ 10
- 2
apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php View File

@@ -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,
];
}


+ 1
- 1
apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php View File

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

+ 1
- 1
apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php View File

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

+ 7
- 0
apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php View File

@@ -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);
}


+ 1
- 0
apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php View File

@@ -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';
}
}

+ 1
- 0
apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php View File

@@ -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';
}
}

Loading…
Cancel
Save