Merge pull request #55630 from nextcloud/fix/caldav/disable-cal-federation-remote-access

fix(caldav): disable remote access when calendar federation is off
pull/55624/head
Richard Steinmetz 2025-10-08 19:22:37 +07:00 committed by GitHub
commit f6593a7464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\DAV\Listener;
use OCA\DAV\CalDAV\Federation\CalendarFederationConfig;
use OCA\DAV\CalDAV\Federation\FederatedCalendarAuth;
use OCA\DAV\Events\SabrePluginAuthInitEvent;
use OCP\EventDispatcher\Event;
@ -20,11 +21,20 @@ use Sabre\DAV\Auth\Plugin;
* @template-implements IEventListener<Event|SabrePluginAuthInitEvent>
*/
class SabrePluginAuthInitListener implements IEventListener {
public function __construct(
private readonly CalendarFederationConfig $calendarFederationConfig,
) {
}
public function handle(Event $event): void {
if (!($event instanceof SabrePluginAuthInitEvent)) {
return;
}
if (!$this->calendarFederationConfig->isFederationEnabled()) {
return;
}
$server = $event->getServer();
$authPlugin = $server->getPlugin('auth');
if ($authPlugin instanceof Plugin) {