|
@@ -26,6 +26,8 @@
|
|
namespace OCA\DAV\CalDAV\InvitationResponse;
|
|
namespace OCA\DAV\CalDAV\InvitationResponse;
|
|
|
|
|
|
use OCA\DAV\AppInfo\PluginManager;
|
|
use OCA\DAV\AppInfo\PluginManager;
|
|
|
|
+use OCA\DAV\CalDAV\Auth\CustomPrincipalPlugin;
|
|
|
|
+use OCA\DAV\CalDAV\Auth\PublicPrincipalPlugin;
|
|
use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin;
|
|
use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin;
|
|
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
|
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
|
use OCA\DAV\Connector\Sabre\CachingTree;
|
|
use OCA\DAV\Connector\Sabre\CachingTree;
|
|
@@ -33,7 +35,6 @@ use OCA\DAV\Connector\Sabre\DavAclPlugin;
|
|
use OCA\DAV\Events\SabrePluginAuthInitEvent;
|
|
use OCA\DAV\Events\SabrePluginAuthInitEvent;
|
|
use OCA\DAV\RootCollection;
|
|
use OCA\DAV\RootCollection;
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
|
-use Sabre\DAV\Auth\Plugin;
|
|
|
|
use Sabre\VObject\ITip\Message;
|
|
use Sabre\VObject\ITip\Message;
|
|
|
|
|
|
class InvitationResponseServer {
|
|
class InvitationResponseServer {
|
|
@@ -44,7 +45,7 @@ class InvitationResponseServer {
|
|
/**
|
|
/**
|
|
* InvitationResponseServer constructor.
|
|
* InvitationResponseServer constructor.
|
|
*/
|
|
*/
|
|
- public function __construct() {
|
|
|
|
|
|
+ public function __construct(bool $public = true) {
|
|
$baseUri = \OC::$WEBROOT . '/remote.php/dav/';
|
|
$baseUri = \OC::$WEBROOT . '/remote.php/dav/';
|
|
$logger = \OC::$server->getLogger();
|
|
$logger = \OC::$server->getLogger();
|
|
/** @var IEventDispatcher $dispatcher */
|
|
/** @var IEventDispatcher $dispatcher */
|
|
@@ -62,11 +63,13 @@ class InvitationResponseServer {
|
|
|
|
|
|
$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
|
|
$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
|
|
$this->server->addPlugin(new AnonymousOptionsPlugin());
|
|
$this->server->addPlugin(new AnonymousOptionsPlugin());
|
|
- $this->server->addPlugin(new class() extends Plugin {
|
|
|
|
- public function getCurrentPrincipal() {
|
|
|
|
- return 'principals/system/public';
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+ // allow custom principal uri option
|
|
|
|
+ if ($public) {
|
|
|
|
+ $this->server->addPlugin(new PublicPrincipalPlugin());
|
|
|
|
+ } else {
|
|
|
|
+ $this->server->addPlugin(new CustomPrincipalPlugin());
|
|
|
|
+ }
|
|
|
|
|
|
// allow setup of additional auth backends
|
|
// allow setup of additional auth backends
|
|
$event = new SabrePluginAuthInitEvent($this->server);
|
|
$event = new SabrePluginAuthInitEvent($this->server);
|