Merge pull request #5299 from nextcloud/bugfix-stable12/4885/calendar_shares_url_special_char_issue
[stable12] urldecode group principals in Cal- and CardDAV backend
This commit is contained in:
commit
c20faa1c98
|
@ -276,6 +276,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
|
|
||||||
// query for shared calendars
|
// query for shared calendars
|
||||||
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
||||||
|
$principals = array_map(function($principal) {
|
||||||
|
return urldecode($principal);
|
||||||
|
}, $principals);
|
||||||
$principals[]= $principalUri;
|
$principals[]= $principalUri;
|
||||||
|
|
||||||
$fields = array_values($this->propertyMap);
|
$fields = array_values($this->propertyMap);
|
||||||
|
|
|
@ -162,6 +162,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
|
|
||||||
// query for shared calendars
|
// query for shared calendars
|
||||||
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
||||||
|
$principals = array_map(function($principal) {
|
||||||
|
return urldecode($principal);
|
||||||
|
}, $principals);
|
||||||
$principals[]= $principalUri;
|
$principals[]= $principalUri;
|
||||||
|
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
|
|
@ -91,6 +91,9 @@ abstract class AbstractCalDavBackendTest extends TestCase {
|
||||||
if (is_null($this->backend)) {
|
if (is_null($this->backend)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$this->principal->expects($this->any())->method('getGroupMembership')
|
||||||
|
->withAnyParameters()
|
||||||
|
->willReturn([self::UNIT_TEST_GROUP, self::UNIT_TEST_GROUP2]);
|
||||||
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
|
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
|
||||||
foreach ($calendars as $calendar) {
|
foreach ($calendars as $calendar) {
|
||||||
$this->dispatcher->expects($this->at(0))
|
$this->dispatcher->expects($this->at(0))
|
||||||
|
|
|
@ -46,6 +46,10 @@ class PublicCalendarRootTest extends TestCase {
|
||||||
$this->random = \OC::$server->getSecureRandom();
|
$this->random = \OC::$server->getSecureRandom();
|
||||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||||
|
|
||||||
|
$this->principal->expects($this->any())->method('getGroupMembership')
|
||||||
|
->withAnyParameters()
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
$this->backend = new CalDavBackend(
|
$this->backend = new CalDavBackend(
|
||||||
$db,
|
$db,
|
||||||
$this->principal,
|
$this->principal,
|
||||||
|
@ -66,6 +70,9 @@ class PublicCalendarRootTest extends TestCase {
|
||||||
if (is_null($this->backend)) {
|
if (is_null($this->backend)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$this->principal->expects($this->any())->method('getGroupMembership')
|
||||||
|
->withAnyParameters()
|
||||||
|
->willReturn([]);
|
||||||
$books = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
|
$books = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
|
||||||
foreach ($books as $book) {
|
foreach ($books as $book) {
|
||||||
$this->backend->deleteCalendar($book['id']);
|
$this->backend->deleteCalendar($book['id']);
|
||||||
|
|
|
@ -113,6 +113,10 @@ class CardDavBackendTest extends TestCase {
|
||||||
if (is_null($this->backend)) {
|
if (is_null($this->backend)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->principal->method('getGroupMembership')
|
||||||
|
->withAnyParameters()
|
||||||
|
->willReturn([self::UNIT_TEST_GROUP]);
|
||||||
$books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER);
|
$books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER);
|
||||||
foreach ($books as $book) {
|
foreach ($books as $book) {
|
||||||
$this->backend->deleteAddressBook($book['id']);
|
$this->backend->deleteAddressBook($book['id']);
|
||||||
|
|
Loading…
Reference in New Issue