@ -131,6 +131,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
/** @var EventDispatcherInterface */
private $dispatcher ;
/** @var bool */
private $legacyEndpoint ;
/**
* CalDavBackend constructor .
*
@ -139,18 +142,21 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @ param IUserManager $userManager
* @ param ISecureRandom $random
* @ param EventDispatcherInterface $dispatcher
* @ param bool $legacyEndpoint
*/
public function __construct ( IDBConnection $db ,
Principal $principalBackend ,
IUserManager $userManager ,
ISecureRandom $random ,
EventDispatcherInterface $dispatcher ) {
EventDispatcherInterface $dispatcher ,
$legacyEndpoint = false ) {
$this -> db = $db ;
$this -> principalBackend = $principalBackend ;
$this -> userManager = $userManager ;
$this -> sharingBackend = new Backend ( $this -> db , $principalBackend , 'calendar' );
$this -> random = $random ;
$this -> dispatcher = $dispatcher ;
$this -> legacyEndpoint = $legacyEndpoint ;
}
/**
@ -230,12 +236,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $row [ 'uri' ],
'principaluri' => $this -> convertPrincipal ( $row [ 'principaluri' ], false ),
'principaluri' => $this -> convertPrincipal ( $row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),
'{' . Plugin :: NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp ( $row [ 'transparent' ] ? 'transparent' : 'opaque' ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $principalUri ,
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $this -> convertPrincipal ( $ principalUri , ! $this -> legacyEndpoint ),
];
foreach ( $this -> propertyMap as $xmlName => $dbName ) {
@ -282,12 +288,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $uri ,
'principaluri' => $principalUri ,
'principaluri' => $this -> convertPrincipal ( $ principalUri , ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),
'{' . Plugin :: NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp ( $row [ 'transparent' ] ? 'transparent' : 'opaque' ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $row [ 'principaluri' ],
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $this -> convertPrincipal ( $ row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}read-only' => ( int ) $row [ 'access' ] === Backend :: ACCESS_READ ,
];
@ -328,7 +334,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $row [ 'uri' ],
'principaluri' => $this -> convertPrincipal ( $row [ 'principaluri' ], false ),
'principaluri' => $this -> convertPrincipal ( $row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),
@ -392,12 +398,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $row [ 'publicuri' ],
'principaluri' => $row [ 'principaluri' ],
'principaluri' => $this -> convertPrincipal ( $ row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),
'{' . Plugin :: NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp ( $row [ 'transparent' ] ? 'transparent' : 'opaque' ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $row [ 'principaluri' ],
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $this -> convertPrincipal ( $ row [ 'principaluri' ], $this -> legacyEndpoint ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}read-only' => ( int ) $row [ 'access' ] === Backend :: ACCESS_READ ,
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}public' => ( int ) $row [ 'access' ] === self :: ACCESS_PUBLIC ,
];
@ -456,12 +462,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $row [ 'publicuri' ],
'principaluri' => $row [ 'principaluri' ],
'principaluri' => $this -> convertPrincipal ( $ row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),
'{' . Plugin :: NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp ( $row [ 'transparent' ] ? 'transparent' : 'opaque' ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $row [ 'principaluri' ],
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}owner-principal' => $this -> convertPrincipal ( $ row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}read-only' => ( int ) $row [ 'access' ] === Backend :: ACCESS_READ ,
'{' . \OCA\DAV\DAV\Sharing\Plugin :: NS_OWNCLOUD . '}public' => ( int ) $row [ 'access' ] === self :: ACCESS_PUBLIC ,
];
@ -510,7 +516,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $row [ 'uri' ],
'principaluri' => $row [ 'principaluri' ],
'principaluri' => $this -> convertPrincipal ( $ row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),
@ -554,7 +560,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row [ 'id' ],
'uri' => $row [ 'uri' ],
'principaluri' => $row [ 'principaluri' ],
'principaluri' => $this -> convertPrincipal ( $ row [ 'principaluri' ], ! $this -> legacyEndpoint ),
'{' . Plugin :: NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ( $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ),
'{http://sabredav.org/ns}sync-token' => $row [ 'synctoken' ] ? $row [ 'synctoken' ] : '0' ,
'{' . Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet ( $components ),