mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #59985 from nextcloud/chore/psalm-v6
chore: update psalm to v6
This commit is contained in:
commit
a0fedf1c7f
2428 changed files with 10849 additions and 446 deletions
|
|
@ -79,6 +79,7 @@ class Application extends App implements IBootstrap {
|
|||
parent::__construct('admin_audit');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function register(IRegistrationContext $context): void {
|
||||
$context->registerService(IAuditLogger::class, function (ContainerInterface $c) {
|
||||
return new AuditLogger($c->get(ILogFactory::class), $c->get(IConfig::class));
|
||||
|
|
@ -132,6 +133,7 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerEventListener(CacheEntryRemovedEvent::class, CacheEventListener::class);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function boot(IBootContext $context): void {
|
||||
/** @var IAuditLogger $logger */
|
||||
$logger = $context->getAppContainer()->get(IAuditLogger::class);
|
||||
|
|
|
|||
|
|
@ -35,38 +35,47 @@ class AuditLogger implements IAuditLogger {
|
|||
$this->parentLogger = $logFactory->getCustomPsrLogger($logFile, $auditType, $auditTag);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function emergency($message, array $context = []): void {
|
||||
$this->parentLogger->emergency($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function alert($message, array $context = []): void {
|
||||
$this->parentLogger->alert($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function critical($message, array $context = []): void {
|
||||
$this->parentLogger->critical($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function error($message, array $context = []): void {
|
||||
$this->parentLogger->error($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function warning($message, array $context = []): void {
|
||||
$this->parentLogger->warning($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function notice($message, array $context = []): void {
|
||||
$this->parentLogger->notice($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function info($message, array $context = []): void {
|
||||
$this->parentLogger->info($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function debug($message, array $context = []): void {
|
||||
$this->parentLogger->debug($message, $context);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function log($level, $message, array $context = []): void {
|
||||
$this->parentLogger->log($level, $message, $context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Rotate extends TimedJob {
|
|||
$this->setInterval(60 * 60 * 3);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument): void {
|
||||
$default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
|
||||
$this->filePath = $this->config->getAppValue('admin_audit', 'logfile', $default);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use OCP\EventDispatcher\IEventListener;
|
|||
* @template-implements IEventListener<AppEnableEvent|AppDisableEvent|AppUpdateEvent>
|
||||
*/
|
||||
class AppManagementEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof AppEnableEvent) {
|
||||
$this->appEnable($event);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use OCP\User\Events\UserLoggedInWithCookieEvent;
|
|||
* @template-implements IEventListener<BeforeUserLoggedInEvent|UserLoggedInWithCookieEvent|UserLoggedInEvent|BeforeUserLoggedOutEvent|AnyLoginFailedEvent>
|
||||
*/
|
||||
class AuthEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof BeforeUserLoggedInEvent) {
|
||||
$this->beforeUserLoggedIn($event);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use OCP\Files\Cache\CacheEntryRemovedEvent;
|
|||
* @template-implements IEventListener<CacheEntryInsertedEvent|CacheEntryRemovedEvent>
|
||||
*/
|
||||
class CacheEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof CacheEntryInsertedEvent) {
|
||||
$this->entryInserted($event);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use OCP\EventDispatcher\IEventListener;
|
|||
* @template-implements IEventListener<ConsoleEvent>
|
||||
*/
|
||||
class ConsoleEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof ConsoleEvent) {
|
||||
$this->runCommand($event);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use OCP\Log\Audit\CriticalActionPerformedEvent;
|
|||
|
||||
/** @template-implements IEventListener<CriticalActionPerformedEvent> */
|
||||
class CriticalActionPerformedEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof CriticalActionPerformedEvent)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use Psr\Log\LoggerInterface;
|
|||
* @template-implements IEventListener<BeforePreviewFetchedEvent|VersionRestoredEvent>
|
||||
*/
|
||||
class FileEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof BeforePreviewFetchedEvent) {
|
||||
$this->beforePreviewFetched($event);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use OCP\Group\Events\UserRemovedEvent;
|
|||
* @template-implements IEventListener<UserAddedEvent|UserRemovedEvent|GroupCreatedEvent|GroupDeletedEvent>
|
||||
*/
|
||||
class GroupManagementEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof UserAddedEvent) {
|
||||
$this->userAdded($event);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use OCP\EventDispatcher\IEventListener;
|
|||
* @template-implements IEventListener<TwoFactorProviderChallengePassed|TwoFactorProviderChallengeFailed>
|
||||
*/
|
||||
class SecurityEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof TwoFactorProviderChallengePassed) {
|
||||
$this->twoFactorProviderChallengePassed($event);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use OCP\Share\IShare;
|
|||
* @template-implements IEventListener<ShareCreatedEvent|ShareDeletedEvent>
|
||||
*/
|
||||
class SharingEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof ShareCreatedEvent) {
|
||||
$this->shareCreated($event);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use OCP\User\Events\UserIdUnassignedEvent;
|
|||
* @template-implements IEventListener<UserCreatedEvent|UserDeletedEvent|UserChangedEvent|PasswordUpdatedEvent|UserIdAssignedEvent|UserIdUnassignedEvent>
|
||||
*/
|
||||
class UserManagementEventListener extends Action implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if ($event instanceof UserCreatedEvent) {
|
||||
$this->userCreated($event);
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ class Application extends App implements IBootstrap {
|
|||
parent::__construct(self::APP_ID);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function register(IRegistrationContext $context): void {
|
||||
$context->registerCapability(Capabilities::class);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function boot(IBootContext $context): void {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class Capabilities implements ICapability, IInitialStateExcludedCapability {
|
|||
* @return array<string, array<string, mixed>>
|
||||
* @throws OCMArgumentException
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCapabilities() {
|
||||
$provider = $this->ocmDiscoveryService->getLocalOCMProvider(false);
|
||||
return ['ocm' => $provider->jsonSerialize()];
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Version1016Date202502262004 extends SimpleMigrationStep {
|
|||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
#[\Override]
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
|
|
|||
|
|
@ -19,18 +19,22 @@ class Filter implements IFilter {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getIdentifier(): string {
|
||||
return 'comments';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->l->t('Comments');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getPriority(): int {
|
||||
return 40;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getIcon(): string {
|
||||
return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
|
||||
}
|
||||
|
|
@ -39,6 +43,7 @@ class Filter implements IFilter {
|
|||
* @param string[] $types
|
||||
* @return string[] An array of allowed apps from which activities should be displayed
|
||||
*/
|
||||
#[\Override]
|
||||
public function filterTypes(array $types): array {
|
||||
return $types;
|
||||
}
|
||||
|
|
@ -46,6 +51,7 @@ class Filter implements IFilter {
|
|||
/**
|
||||
* @return string[] An array of allowed apps from which activities should be displayed
|
||||
*/
|
||||
#[\Override]
|
||||
public function allowedApps(): array {
|
||||
return ['comments'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class Provider implements IProvider {
|
|||
* @throws UnknownActivityException
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
|
||||
if ($event->getApp() !== 'comments') {
|
||||
throw new UnknownActivityException();
|
||||
|
|
|
|||
|
|
@ -17,38 +17,47 @@ class Setting extends ActivitySettings {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getIdentifier(): string {
|
||||
return 'comments';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->l->t('<strong>Comments</strong> for files');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroupIdentifier(): string {
|
||||
return 'files';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroupName(): string {
|
||||
return $this->l->t('Files');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getPriority(): int {
|
||||
return 50;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function canChangeStream(): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isDefaultEnabledStream(): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function canChangeMail(): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isDefaultEnabledMail(): bool {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class Application extends App implements IBootstrap {
|
|||
parent::__construct(self::APP_ID, $urlParams);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function register(IRegistrationContext $context): void {
|
||||
$context->registerCapability(Capabilities::class);
|
||||
|
||||
|
|
@ -59,6 +60,7 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerNotifierService(Notifier::class);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function boot(IBootContext $context): void {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Capabilities implements ICapability {
|
|||
/**
|
||||
* @return array{files: array{comments: bool}}
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCapabilities(): array {
|
||||
return [
|
||||
'files' => [
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class CommentersSorter implements ISorter {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getId(): string {
|
||||
return 'commenters';
|
||||
}
|
||||
|
|
@ -26,6 +27,7 @@ class CommentersSorter implements ISorter {
|
|||
* @param array &$sortArray
|
||||
* @param array $context
|
||||
*/
|
||||
#[\Override]
|
||||
public function sort(array &$sortArray, array $context): void {
|
||||
if (!isset($context['itemType'], $context['itemId'])) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class CommentsEntityEventListener implements IEventListener {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof CommentsEntityEvent)) {
|
||||
// Unrelated
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class CommentsEventListener implements IEventListener {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!$event instanceof CommentsEvent) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use OCP\Util;
|
|||
|
||||
/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
|
||||
class LoadAdditionalScripts implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof LoadAdditionalScriptsEvent)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class LoadSidebarScripts implements IEventListener {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof LoadSidebar)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ class MaxAutoCompleteResultsInitialState extends InitialStateProvider {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getKey(): string {
|
||||
return 'maxAutoCompleteResults';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getData(): int {
|
||||
return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class Notifier implements INotifier {
|
|||
* @return string
|
||||
* @since 17.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getID(): string {
|
||||
return 'comments';
|
||||
}
|
||||
|
|
@ -45,6 +46,7 @@ class Notifier implements INotifier {
|
|||
* @return string
|
||||
* @since 17.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->l10nFactory->get('comments')->t('Comments');
|
||||
}
|
||||
|
|
@ -57,6 +59,7 @@ class Notifier implements INotifier {
|
|||
* @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
|
||||
* @since 9.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function prepare(INotification $notification, string $languageCode): INotification {
|
||||
if ($notification->getApp() !== 'comments') {
|
||||
throw new UnknownNotificationException();
|
||||
|
|
|
|||
|
|
@ -34,14 +34,17 @@ class CommentsSearchProvider implements IProvider {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getId(): string {
|
||||
return 'comments';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Comments');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOrder(string $route, array $routeParameters): int {
|
||||
if ($route === 'files.View.index') {
|
||||
// Files first
|
||||
|
|
@ -50,6 +53,7 @@ class CommentsSearchProvider implements IProvider {
|
|||
return 10;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function search(IUser $user, ISearchQuery $query): SearchResult {
|
||||
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
#[\Override]
|
||||
public function delete(): void {
|
||||
throw new Exception('This addressbook is immutable');
|
||||
}
|
||||
|
|
@ -46,6 +47,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
#[\Override]
|
||||
public function createFile($name, $data = null) {
|
||||
throw new Exception('This addressbook is immutable');
|
||||
}
|
||||
|
|
@ -54,6 +56,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
* @inheritDoc
|
||||
* @throws NotFound
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChild($name): Card {
|
||||
try {
|
||||
return new Card(
|
||||
|
|
@ -72,6 +75,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren(): array {
|
||||
return array_map(
|
||||
function (RecentContact $contact) {
|
||||
|
|
@ -88,6 +92,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function childExists($name): bool {
|
||||
try {
|
||||
$this->mapper->find(
|
||||
|
|
@ -103,6 +108,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getLastModified(): ?int {
|
||||
return $this->mapper->findLastUpdatedForUserId($this->getUid());
|
||||
}
|
||||
|
|
@ -111,6 +117,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
#[\Override]
|
||||
public function propPatch(PropPatch $propPatch) {
|
||||
throw new Exception('This addressbook is immutable');
|
||||
}
|
||||
|
|
@ -118,6 +125,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getProperties($properties): array {
|
||||
return [
|
||||
'principaluri' => $this->principalUri,
|
||||
|
|
@ -127,6 +135,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner(): string {
|
||||
return $this->principalUri;
|
||||
}
|
||||
|
|
@ -134,6 +143,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL(): array {
|
||||
return [
|
||||
[
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class AddressBookProvider implements IAddressBookProvider {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getAppId(): string {
|
||||
return Application::APP_ID;
|
||||
}
|
||||
|
|
@ -32,6 +33,7 @@ class AddressBookProvider implements IAddressBookProvider {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function fetchAllForAddressBookHome(string $principalUri): array {
|
||||
return [
|
||||
new AddressBook($this->mapper, $this->l10n, $principalUri)
|
||||
|
|
@ -41,6 +43,7 @@ class AddressBookProvider implements IAddressBookProvider {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool {
|
||||
return $uri === AddressBook::URI;
|
||||
}
|
||||
|
|
@ -48,6 +51,7 @@ class AddressBookProvider implements IAddressBookProvider {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook {
|
||||
if ($uri === AddressBook::URI) {
|
||||
return new AddressBook($this->mapper, $this->l10n, $principalUri);
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ class Application extends App implements IBootstrap {
|
|||
parent::__construct(self::APP_ID);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function register(IRegistrationContext $context): void {
|
||||
$context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
|
||||
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function boot(IBootContext $context): void {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class CleanupJob extends TimedJob {
|
|||
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run(mixed $argument): void {
|
||||
$time = $this->time->getDateTime();
|
||||
$time->modify('-7days');
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getOwner(): ?string {
|
||||
return $this->principal;
|
||||
}
|
||||
|
|
@ -35,6 +36,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL(): array {
|
||||
return [
|
||||
[
|
||||
|
|
@ -55,6 +57,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function put($data): ?string {
|
||||
throw new NotImplemented();
|
||||
}
|
||||
|
|
@ -62,6 +65,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function get(): string {
|
||||
return $this->contact->getCard();
|
||||
}
|
||||
|
|
@ -69,6 +73,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getContentType(): ?string {
|
||||
return 'text/vcard; charset=utf-8';
|
||||
}
|
||||
|
|
@ -76,6 +81,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getETag(): ?string {
|
||||
return '"' . md5((string)$this->getLastModified()) . '"';
|
||||
}
|
||||
|
|
@ -83,6 +89,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getSize(): int {
|
||||
return strlen($this->contact->getCard());
|
||||
}
|
||||
|
|
@ -90,6 +97,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function delete(): void {
|
||||
$this->mapper->delete($this->contact);
|
||||
}
|
||||
|
|
@ -97,6 +105,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return (string)$this->contact->getId();
|
||||
}
|
||||
|
|
@ -104,6 +113,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function setName($name): void {
|
||||
throw new NotImplemented();
|
||||
}
|
||||
|
|
@ -111,6 +121,7 @@ class Card implements ICard, IACL {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getLastModified(): ?int {
|
||||
return $this->contact->getLastContact();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class ContactInteractionListener implements IEventListener {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof ContactInteractedWithEvent)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ class FixVcardCategory implements IRepairStep {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return 'Fix category of recent contacts vcards';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run(IOutput $output): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class Version010000Date20200304152605 extends SimpleMigrationStep {
|
|||
*
|
||||
* @return ISchemaWrapper
|
||||
*/
|
||||
#[\Override]
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ class Application extends App implements IBootstrap {
|
|||
parent::__construct(self::APP_ID);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function register(IRegistrationContext $context): void {
|
||||
$context->registerServiceAlias('CardDAVSyncService', SyncService::class);
|
||||
$context->registerService(AppCalendarPlugin::class, function (ContainerInterface $c) {
|
||||
|
|
@ -235,6 +236,7 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerConfigLexicon(ConfigLexicon::class);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function boot(IBootContext $context): void {
|
||||
// Load all dav apps
|
||||
$context->getServerContainer()->get(IAppManager::class)->loadApps(['dav']);
|
||||
|
|
|
|||
|
|
@ -28,14 +28,17 @@ class AvatarHome implements ICollection {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function createFile($name, $data = null) {
|
||||
throw new Forbidden('Permission denied to create a file');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function createDirectory($name) {
|
||||
throw new Forbidden('Permission denied to create a folder');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
$elements = pathinfo($name);
|
||||
$ext = $elements['extension'] ?? '';
|
||||
|
|
@ -53,6 +56,7 @@ class AvatarHome implements ICollection {
|
|||
return new AvatarNode($size, $ext, $avatar);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChildren() {
|
||||
try {
|
||||
return [
|
||||
|
|
@ -63,6 +67,7 @@ class AvatarHome implements ICollection {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function childExists($name) {
|
||||
try {
|
||||
$ret = $this->getChild($name);
|
||||
|
|
@ -74,15 +79,18 @@ class AvatarHome implements ICollection {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function delete() {
|
||||
throw new Forbidden('Permission denied to delete this folder');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
[,$name] = Uri\split($this->principalInfo['uri']);
|
||||
return $name;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function setName($name) {
|
||||
throw new Forbidden('Permission denied to rename this folder');
|
||||
}
|
||||
|
|
@ -92,6 +100,7 @@ class AvatarHome implements ICollection {
|
|||
*
|
||||
* @return int|null
|
||||
*/
|
||||
#[\Override]
|
||||
public function getLastModified() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,12 @@ class AvatarNode extends File {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return "$this->size.$this->ext";
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get() {
|
||||
$image = $this->avatar->get($this->size);
|
||||
$res = $image->resource();
|
||||
|
|
@ -57,6 +59,7 @@ class AvatarNode extends File {
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
#[\Override]
|
||||
public function getContentType() {
|
||||
if ($this->ext === 'png') {
|
||||
return 'image/png';
|
||||
|
|
@ -64,10 +67,12 @@ class AvatarNode extends File {
|
|||
return 'image/jpeg';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getETag() {
|
||||
return $this->avatar->getFile($this->size)->getEtag();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getLastModified() {
|
||||
return $this->avatar->getFile($this->size)->getMTime();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,13 @@ class RootCollection extends AbstractPrincipalCollection {
|
|||
* @param array $principalInfo
|
||||
* @return AvatarHome
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildForPrincipal(array $principalInfo) {
|
||||
$avatarManager = Server::get(IAvatarManager::class);
|
||||
return new AvatarHome($principalInfo, $avatarManager);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return 'avatars';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
|
|||
$this->timeFactory = $timeFactory;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run($argument) {
|
||||
$offset = (int)$argument['offset'];
|
||||
$stopAt = (int)$argument['stopAt'];
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class CalendarRetentionJob extends TimedJob {
|
|||
$this->setTimeSensitivity(self::TIME_SENSITIVE);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument): void {
|
||||
$this->service->cleanUp();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class CleanupDirectLinksJob extends TimedJob {
|
|||
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument) {
|
||||
// Delete all shares expired 24 hours ago
|
||||
$this->mapper->deleteExpired($this->time->getTime() - 60 * 60 * 24);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class CleanupInvitationTokenJob extends TimedJob {
|
|||
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run($argument): void {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('calendar_invitations')
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class CleanupOrphanedChildrenJob extends QueuedJob {
|
|||
parent::__construct($time);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument): void {
|
||||
$childTable = $argument[self::ARGUMENT_CHILD_TABLE];
|
||||
$parentTable = $argument[self::ARGUMENT_PARENT_TABLE];
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class DeleteOutdatedSchedulingObjects extends TimedJob {
|
|||
/**
|
||||
* @param array $argument
|
||||
*/
|
||||
#[\Override]
|
||||
protected function run($argument): void {
|
||||
$time = $this->time->getTime() - (60 * 60);
|
||||
$this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class EventReminderJob extends TimedJob {
|
|||
* @throws NotificationTypeDoesNotExistException
|
||||
* @throws NoUserException
|
||||
*/
|
||||
#[\Override]
|
||||
public function run($argument):void {
|
||||
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class FederatedCalendarPeriodicSyncJob extends TimedJob {
|
|||
$this->setInterval(3600);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument): void {
|
||||
if (!$this->calendarFederationConfig->isFederationEnabled()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class FederatedCalendarSyncJob extends QueuedJob {
|
|||
$this->setAllowParallelRuns(false);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument): void {
|
||||
if (!$this->calendarFederationConfig->isFederationEnabled()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class GenerateBirthdayCalendarBackgroundJob extends QueuedJob {
|
|||
parent::__construct($time);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run($argument) {
|
||||
$userId = $argument['userId'];
|
||||
$purgeBeforeGenerating = $argument['purgeBeforeGenerating'] ?? false;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class OutOfOfficeEventDispatcherJob extends QueuedJob {
|
|||
parent::__construct($time);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run($argument): void {
|
||||
$id = $argument['id'];
|
||||
$event = $argument['event'];
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class PruneOutdatedSyncTokensJob extends TimedJob {
|
|||
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run($argument) {
|
||||
$limit = max(1, (int)$this->config->getAppValue(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000'));
|
||||
$retention = max(7, (int)$this->config->getAppValue(Application::APP_ID, 'syncTokensRetentionDays', '60')) * 24 * 3600;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class RefreshWebcalJob extends Job {
|
|||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function start(IJobList $jobList): void {
|
||||
$subscription = $this->refreshWebcalService->getSubscription($this->argument['principaluri'], $this->argument['uri']);
|
||||
if (!$subscription) {
|
||||
|
|
@ -69,6 +70,7 @@ class RefreshWebcalJob extends Job {
|
|||
/**
|
||||
* @param array $argument
|
||||
*/
|
||||
#[\Override]
|
||||
protected function run($argument) {
|
||||
$this->refreshWebcalService->refreshSubscription($argument['principaluri'], $argument['uri']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function run($argument) {
|
||||
$this->userManager->callForSeenUsers(function (IUser $user): void {
|
||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
$this->setTimeSensitivity(self::TIME_SENSITIVE);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function run($argument): void {
|
||||
$this->resourceManager->update();
|
||||
$this->roomManager->update();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class UploadCleanup extends TimedJob {
|
|||
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function run($argument) {
|
||||
$uid = $argument['uid'];
|
||||
$folder = $argument['folder'];
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class UserStatusAutomation extends TimedJob {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
protected function run($argument) {
|
||||
if (!isset($argument['userId'])) {
|
||||
$this->jobList->remove(self::class, $argument);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class BulkUploadPlugin extends ServerPlugin {
|
|||
/**
|
||||
* Register listener on POST requests with the httpPost method.
|
||||
*/
|
||||
#[\Override]
|
||||
public function initialize(Server $server): void {
|
||||
$server->on('method:POST', [$this, 'httpPost'], 10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Calendar implements IFilter {
|
|||
* @return string Lowercase a-z and underscore only identifier
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIdentifier() {
|
||||
return 'calendar';
|
||||
}
|
||||
|
|
@ -32,6 +33,7 @@ class Calendar implements IFilter {
|
|||
* @return string A translated string
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return $this->l->t('Calendar');
|
||||
}
|
||||
|
|
@ -42,6 +44,7 @@ class Calendar implements IFilter {
|
|||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPriority() {
|
||||
return 40;
|
||||
}
|
||||
|
|
@ -50,6 +53,7 @@ class Calendar implements IFilter {
|
|||
* @return string Full URL to an icon, empty string when none is given
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIcon() {
|
||||
return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg'));
|
||||
}
|
||||
|
|
@ -59,6 +63,7 @@ class Calendar implements IFilter {
|
|||
* @return string[] An array of allowed apps from which activities should be displayed
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function filterTypes(array $types) {
|
||||
return array_intersect(['calendar', 'calendar_event'], $types);
|
||||
}
|
||||
|
|
@ -67,6 +72,7 @@ class Calendar implements IFilter {
|
|||
* @return string[] An array of allowed apps from which activities should be displayed
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function allowedApps() {
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Todo implements IFilter {
|
|||
* @return string Lowercase a-z and underscore only identifier
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIdentifier() {
|
||||
return 'calendar_todo';
|
||||
}
|
||||
|
|
@ -32,6 +33,7 @@ class Todo implements IFilter {
|
|||
* @return string A translated string
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return $this->l->t('Tasks');
|
||||
}
|
||||
|
|
@ -42,6 +44,7 @@ class Todo implements IFilter {
|
|||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPriority() {
|
||||
return 40;
|
||||
}
|
||||
|
|
@ -50,6 +53,7 @@ class Todo implements IFilter {
|
|||
* @return string Full URL to an icon, empty string when none is given
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIcon() {
|
||||
return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'));
|
||||
}
|
||||
|
|
@ -59,6 +63,7 @@ class Todo implements IFilter {
|
|||
* @return string[] An array of allowed apps from which activities should be displayed
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function filterTypes(array $types) {
|
||||
return array_intersect(['calendar_todo'], $types);
|
||||
}
|
||||
|
|
@ -67,6 +72,7 @@ class Todo implements IFilter {
|
|||
* @return string[] An array of allowed apps from which activities should be displayed
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function allowedApps() {
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class Calendar extends Base {
|
|||
* @throws UnknownActivityException
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
|
||||
if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') {
|
||||
throw new UnknownActivityException();
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ class Event extends Base {
|
|||
* @throws UnknownActivityException
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
|
||||
if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') {
|
||||
throw new UnknownActivityException();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Todo extends Event {
|
|||
* @throws UnknownActivityException
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
|
||||
if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') {
|
||||
throw new UnknownActivityException();
|
||||
|
|
@ -72,6 +73,7 @@ class Todo extends Event {
|
|||
* @param IEvent $event
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
protected function getParameters(IEvent $event) {
|
||||
$subject = $event->getSubject();
|
||||
$parameters = $event->getSubjectParameters();
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ abstract class CalDAVSetting extends ActivitySettings {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroupIdentifier() {
|
||||
return 'calendar';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroupName() {
|
||||
return $this->l->t('Calendar, contacts and tasks');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class Calendar extends CalDAVSetting {
|
|||
* @return string Lowercase a-z and underscore only identifier
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIdentifier() {
|
||||
return 'calendar';
|
||||
}
|
||||
|
|
@ -21,6 +22,7 @@ class Calendar extends CalDAVSetting {
|
|||
* @return string A translated string
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return $this->l->t('A <strong>calendar</strong> was modified');
|
||||
}
|
||||
|
|
@ -31,6 +33,7 @@ class Calendar extends CalDAVSetting {
|
|||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPriority() {
|
||||
return 50;
|
||||
}
|
||||
|
|
@ -39,6 +42,7 @@ class Calendar extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function canChangeStream() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -47,6 +51,7 @@ class Calendar extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDefaultEnabledStream() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -55,6 +60,7 @@ class Calendar extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the mail
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function canChangeMail() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -63,6 +69,7 @@ class Calendar extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDefaultEnabledMail() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class Event extends CalDAVSetting {
|
|||
* @return string Lowercase a-z and underscore only identifier
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIdentifier() {
|
||||
return 'calendar_event';
|
||||
}
|
||||
|
|
@ -21,6 +22,7 @@ class Event extends CalDAVSetting {
|
|||
* @return string A translated string
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return $this->l->t('A calendar <strong>event</strong> was modified');
|
||||
}
|
||||
|
|
@ -31,6 +33,7 @@ class Event extends CalDAVSetting {
|
|||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPriority() {
|
||||
return 50;
|
||||
}
|
||||
|
|
@ -39,6 +42,7 @@ class Event extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function canChangeStream() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -47,6 +51,7 @@ class Event extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDefaultEnabledStream() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -55,6 +60,7 @@ class Event extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the mail
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function canChangeMail() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -63,6 +69,7 @@ class Event extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDefaultEnabledMail() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Todo extends CalDAVSetting {
|
|||
* @return string Lowercase a-z and underscore only identifier
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getIdentifier() {
|
||||
return 'calendar_todo';
|
||||
}
|
||||
|
|
@ -22,6 +23,7 @@ class Todo extends CalDAVSetting {
|
|||
* @return string A translated string
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
return $this->l->t('A calendar <strong>to-do</strong> was modified');
|
||||
}
|
||||
|
|
@ -32,6 +34,7 @@ class Todo extends CalDAVSetting {
|
|||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPriority() {
|
||||
return 50;
|
||||
}
|
||||
|
|
@ -40,6 +43,7 @@ class Todo extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function canChangeStream() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -48,6 +52,7 @@ class Todo extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDefaultEnabledStream() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -56,6 +61,7 @@ class Todo extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the mail
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function canChangeMail() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -64,6 +70,7 @@ class Todo extends CalDAVSetting {
|
|||
* @return bool True when the option can be changed for the stream
|
||||
* @since 11.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDefaultEnabledMail() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,14 +47,17 @@ class AppCalendar extends ExternalCalendar {
|
|||
return Constants::PERMISSION_READ;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner(): ?string {
|
||||
return $this->principal;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroup(): ?string {
|
||||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getACL(): array {
|
||||
$acl = [
|
||||
[
|
||||
|
|
@ -78,25 +81,30 @@ class AppCalendar extends ExternalCalendar {
|
|||
return $acl;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function setACL(array $acl): void {
|
||||
throw new Forbidden('Setting ACL is not supported on this node');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getSupportedPrivilegeSet(): ?array {
|
||||
// Use the default one
|
||||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getLastModified(): ?int {
|
||||
// unknown
|
||||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function delete(): void {
|
||||
// No method for deleting a calendar in OCP\Calendar\ICalendar
|
||||
throw new Forbidden('Deleting an entry is not implemented');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function createFile($name, $data = null) {
|
||||
if ($this->calendar instanceof ICreateFromString) {
|
||||
if (is_resource($data)) {
|
||||
|
|
@ -109,6 +117,7 @@ class AppCalendar extends ExternalCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getProperties($properties) {
|
||||
return [
|
||||
'{DAV:}displayname' => $this->calendar->getDisplayName() ?: $this->calendar->getKey(),
|
||||
|
|
@ -117,6 +126,7 @@ class AppCalendar extends ExternalCalendar {
|
|||
];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function calendarQuery(array $filters) {
|
||||
$result = [];
|
||||
$objects = $this->getChildren();
|
||||
|
|
@ -143,6 +153,7 @@ class AppCalendar extends ExternalCalendar {
|
|||
return $result;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function childExists($name): bool {
|
||||
try {
|
||||
$this->getChild($name);
|
||||
|
|
@ -152,6 +163,7 @@ class AppCalendar extends ExternalCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
// Try to get calendar by filename
|
||||
$children = $this->calendar->search($name, ['X-FILENAME']);
|
||||
|
|
@ -171,6 +183,7 @@ class AppCalendar extends ExternalCalendar {
|
|||
/**
|
||||
* @return ICalendarObject[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren(): array {
|
||||
$objects = $this->calendar->search('');
|
||||
// We need to group by UID (actually by filename but we do not have that information)
|
||||
|
|
@ -188,6 +201,7 @@ class AppCalendar extends ExternalCalendar {
|
|||
}, $result);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function propPatch(PropPatch $propPatch): void {
|
||||
// no setDisplayColor or setDisplayName in \OCP\Calendar\ICalendar
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,20 +25,24 @@ class AppCalendarPlugin implements ICalendarProvider {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getAppID(): string {
|
||||
return 'dav-wrapper';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function fetchAllForCalendarHome(string $principalUri): array {
|
||||
return array_map(function ($calendar) use (&$principalUri) {
|
||||
return new AppCalendar($this->getAppID(), $calendar, $principalUri);
|
||||
}, $this->getWrappedCalendars($principalUri));
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool {
|
||||
return count($this->getWrappedCalendars($principalUri, [ $calendarUri ])) > 0;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar {
|
||||
$calendars = $this->getWrappedCalendars($principalUri, [ $calendarUri ]);
|
||||
if (count($calendars) > 0) {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,17 @@ class CalendarObject implements ICalendarObject, IACL {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner() {
|
||||
return $this->calendar->getOwner();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroup() {
|
||||
return $this->calendar->getGroup();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getACL(): array {
|
||||
$acl = [
|
||||
[
|
||||
|
|
@ -53,14 +56,17 @@ class CalendarObject implements ICalendarObject, IACL {
|
|||
return $acl;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function setACL(array $acl): void {
|
||||
throw new Forbidden('Setting ACL is not supported on this node');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getSupportedPrivilegeSet(): ?array {
|
||||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function put($data): void {
|
||||
if ($this->backend instanceof ICreateFromString && $this->calendar->getPermissions() & Constants::PERMISSION_UPDATE) {
|
||||
if (is_resource($data)) {
|
||||
|
|
@ -72,22 +78,27 @@ class CalendarObject implements ICalendarObject, IACL {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get(): string {
|
||||
return $this->vobject->serialize();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getContentType(): string {
|
||||
return 'text/calendar; charset=utf-8';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getETag(): ?string {
|
||||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getSize() {
|
||||
return mb_strlen($this->vobject->serialize());
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function delete(): void {
|
||||
if ($this->backend instanceof ICreateFromString && $this->calendar->getPermissions() & Constants::PERMISSION_DELETE) {
|
||||
/** @var \Sabre\VObject\Component[] */
|
||||
|
|
@ -105,6 +116,7 @@ class CalendarObject implements ICalendarObject, IACL {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
// Every object is required to have an UID
|
||||
$base = $this->vobject->getBaseComponent();
|
||||
|
|
@ -118,10 +130,12 @@ class CalendarObject implements ICalendarObject, IACL {
|
|||
return (string)$base->UID . '.ics';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function setName($name): void {
|
||||
throw new Forbidden('This calendar-object is read-only');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getLastModified(): ?int {
|
||||
$base = $this->vobject->getBaseComponent();
|
||||
if ($base !== null && $this->vobject->getBaseComponent()->{'LAST-MODIFIED'}) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use Sabre\DAV\Auth\Plugin;
|
|||
* Defines the public facing principal option
|
||||
*/
|
||||
class PublicPrincipalPlugin extends Plugin {
|
||||
#[\Override]
|
||||
public function getCurrentPrincipal(): ?string {
|
||||
return 'principals/system/public';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ class EnablePlugin extends ServerPlugin {
|
|||
*
|
||||
* @return string[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getFeatures() {
|
||||
return ['nc-enable-birthday-calendar'];
|
||||
}
|
||||
|
|
@ -64,6 +65,7 @@ class EnablePlugin extends ServerPlugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPluginName() {
|
||||
return 'nc-enable-birthday-calendar';
|
||||
}
|
||||
|
|
@ -78,6 +80,7 @@ class EnablePlugin extends ServerPlugin {
|
|||
*
|
||||
* @param Server $server
|
||||
*/
|
||||
#[\Override]
|
||||
public function initialize(Server $server) {
|
||||
$this->server = $server;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL() {
|
||||
return [
|
||||
[
|
||||
|
|
@ -65,6 +66,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildACL() {
|
||||
return [
|
||||
[
|
||||
|
|
@ -89,6 +91,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
#[\Override]
|
||||
public function getOwner() {
|
||||
if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}owner-principal'];
|
||||
|
|
@ -97,6 +100,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
}
|
||||
|
||||
|
||||
#[\Override]
|
||||
public function delete() {
|
||||
$this->caldavBackend->deleteSubscription($this->calendarInfo['id']);
|
||||
}
|
||||
|
|
@ -104,6 +108,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
/**
|
||||
* @param PropPatch $propPatch
|
||||
*/
|
||||
#[\Override]
|
||||
public function propPatch(PropPatch $propPatch) {
|
||||
$this->caldavBackend->updateSubscription($this->calendarInfo['id'], $propPatch);
|
||||
}
|
||||
|
|
@ -113,6 +118,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
* @return CalendarObject|\Sabre\CalDAV\ICalendarObject
|
||||
* @throws NotFound
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
if (!$obj) {
|
||||
|
|
@ -126,6 +132,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
/**
|
||||
* @return INode[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren(): array {
|
||||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
|
||||
|
|
@ -141,6 +148,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
* @param array $paths
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getMultipleChildren(array $paths):array {
|
||||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
|
||||
|
|
@ -158,6 +166,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
* @return null|string
|
||||
* @throws MethodNotAllowed
|
||||
*/
|
||||
#[\Override]
|
||||
public function createFile($name, $data = null) {
|
||||
throw new MethodNotAllowed('Creating objects in cached subscription is not allowed');
|
||||
}
|
||||
|
|
@ -166,6 +175,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
#[\Override]
|
||||
public function childExists($name):bool {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
if (!$obj) {
|
||||
|
|
@ -179,6 +189,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
* @param array $filters
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function calendarQuery(array $filters):array {
|
||||
return $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
}
|
||||
|
|
@ -186,6 +197,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChanges($syncToken, $syncLevel, $limit = null) {
|
||||
if (!$syncToken && $limit) {
|
||||
throw new UnsupportedLimitOnInitialSyncException();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar
|
|||
* @return string defining the technical unique key
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getKey(): string {
|
||||
return (string)$this->calendarInfo['id'];
|
||||
}
|
||||
|
|
@ -35,6 +36,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function getUri(): string {
|
||||
return $this->calendarInfo['uri'];
|
||||
}
|
||||
|
|
@ -43,6 +45,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar
|
|||
* In comparison to getKey() this function returns a human readable (maybe translated) name
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getDisplayName(): ?string {
|
||||
return $this->calendarInfo['{DAV:}displayname'];
|
||||
}
|
||||
|
|
@ -51,10 +54,12 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar
|
|||
* Calendar color
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getDisplayColor(): ?string {
|
||||
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array {
|
||||
return $this->backend->search($this->calendarInfo, $pattern, $searchProperties, $options, $limit, $offset);
|
||||
}
|
||||
|
|
@ -63,6 +68,7 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar
|
|||
* @return int build up using \OCP\Constants
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPermissions(): int {
|
||||
$permissions = $this->calendar->getACL();
|
||||
$result = 0;
|
||||
|
|
@ -80,18 +86,22 @@ class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendar
|
|||
/**
|
||||
* @since 32.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isEnabled(): bool {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isWritable(): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isDeleted(): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isShared(): bool {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject {
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function get() {
|
||||
// Pre-populating the 'calendardata' is optional, if we don't have it
|
||||
// already we fetch it from the backend.
|
||||
|
|
@ -36,6 +37,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject {
|
|||
* @return string
|
||||
* @throws MethodNotAllowed
|
||||
*/
|
||||
#[\Override]
|
||||
public function put($calendarData) {
|
||||
throw new MethodNotAllowed('Creating objects in a cached subscription is not allowed');
|
||||
}
|
||||
|
|
@ -43,6 +45,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject {
|
|||
/**
|
||||
* @throws MethodNotAllowed
|
||||
*/
|
||||
#[\Override]
|
||||
public function delete() {
|
||||
throw new MethodNotAllowed('Deleting objects in a cached subscription is not allowed');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class CachedSubscriptionProvider implements ICalendarProvider {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getCalendars(string $principalUri, array $calendarUris = []): array {
|
||||
$calendarInfos = $this->calDavBackend->getSubscriptionsForUser($principalUri);
|
||||
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $principalUri
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCalendarsForUser($principalUri) {
|
||||
return $this->atomic(function () use ($principalUri) {
|
||||
$principalUriOriginal = $principalUri;
|
||||
|
|
@ -811,6 +812,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
*
|
||||
* @throws CalendarException
|
||||
*/
|
||||
#[\Override]
|
||||
public function createCalendar($principalUri, $calendarUri, array $properties) {
|
||||
if (strlen($calendarUri) > 255) {
|
||||
throw new CalendarException('URI too long. Calendar not created');
|
||||
|
|
@ -883,6 +885,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param PropPatch $propPatch
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function updateCalendar($calendarId, PropPatch $propPatch) {
|
||||
$supportedProperties = array_keys($this->propertyMap);
|
||||
$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
|
||||
|
|
@ -929,6 +932,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param mixed $calendarId
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) {
|
||||
$this->publishStatusCache->remove((string)$calendarId);
|
||||
|
||||
|
|
@ -1127,6 +1131,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
|
||||
|
|
@ -1239,6 +1244,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array|null
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$key = $calendarId . '::' . $objectUri . '::' . $calendarType;
|
||||
if (isset($this->cachedObjects[$key])) {
|
||||
|
|
@ -1292,6 +1298,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
|
||||
if (empty($uris)) {
|
||||
return [];
|
||||
|
|
@ -1350,6 +1357,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return string
|
||||
*/
|
||||
#[\Override]
|
||||
public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$this->cachedObjects = [];
|
||||
$extraData = $this->getDenormalizedData($calendarData);
|
||||
|
|
@ -1447,6 +1455,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return string
|
||||
*/
|
||||
#[\Override]
|
||||
public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$this->cachedObjects = [];
|
||||
$extraData = $this->getDenormalizedData($calendarData);
|
||||
|
|
@ -1560,6 +1569,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param bool $forceDeletePermanently
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) {
|
||||
$this->cachedObjects = [];
|
||||
$this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void {
|
||||
|
|
@ -1744,6 +1754,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
|
||||
$componentType = null;
|
||||
$requirePostFilter = true;
|
||||
|
|
@ -2442,6 +2453,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $uid
|
||||
* @return string|null
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCalendarObjectByUID($principalUri, $uid, $calendarUri = null) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
|
||||
|
|
@ -2553,6 +2565,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return ?array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
|
||||
|
||||
|
|
@ -2653,6 +2666,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $principalUri
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getSubscriptionsForUser($principalUri) {
|
||||
$fields = array_column($this->subscriptionPropertyMap, 0);
|
||||
$fields[] = 'id';
|
||||
|
|
@ -2699,6 +2713,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param array $properties
|
||||
* @return mixed
|
||||
*/
|
||||
#[\Override]
|
||||
public function createSubscription($principalUri, $uri, array $properties) {
|
||||
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
|
||||
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
|
||||
|
|
@ -2759,6 +2774,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param PropPatch $propPatch
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function updateSubscription($subscriptionId, PropPatch $propPatch) {
|
||||
$supportedProperties = array_keys($this->subscriptionPropertyMap);
|
||||
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
|
||||
|
|
@ -2800,6 +2816,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param mixed $subscriptionId
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function deleteSubscription($subscriptionId) {
|
||||
$this->atomic(function () use ($subscriptionId): void {
|
||||
$subscriptionRow = $this->getSubscriptionById($subscriptionId);
|
||||
|
|
@ -2847,6 +2864,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $objectUri
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getSchedulingObject($principalUri, $objectUri) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
|
||||
|
|
@ -2881,6 +2899,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $principalUri
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getSchedulingObjects($principalUri) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
|
||||
|
|
@ -2910,6 +2929,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $objectUri
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function deleteSchedulingObject($principalUri, $objectUri) {
|
||||
$this->cachedObjects = [];
|
||||
$query = $this->db->getQueryBuilder();
|
||||
|
|
@ -2965,6 +2985,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $objectData
|
||||
* @return void
|
||||
*/
|
||||
#[\Override]
|
||||
public function createSchedulingObject($principalUri, $objectUri, $objectData) {
|
||||
$this->cachedObjects = [];
|
||||
$query = $this->db->getQueryBuilder();
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
* {@inheritdoc}
|
||||
* @throws Forbidden
|
||||
*/
|
||||
#[\Override]
|
||||
public function updateShares(array $add, array $remove): void {
|
||||
if ($this->isShared()) {
|
||||
throw new Forbidden();
|
||||
|
|
@ -91,6 +92,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
*
|
||||
* @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}>
|
||||
*/
|
||||
#[\Override]
|
||||
public function getShares(): array {
|
||||
if ($this->isShared()) {
|
||||
return [];
|
||||
|
|
@ -98,6 +100,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return $this->caldavBackend->getShares($this->getResourceId());
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getResourceId(): int {
|
||||
return $this->calendarInfo['id'];
|
||||
}
|
||||
|
|
@ -114,6 +117,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
* @param list<array{privilege: string, principal: string, protected: bool}> $acl
|
||||
* @return list<array{privilege: string, principal: ?string, protected: bool}>
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL() {
|
||||
$acl = [
|
||||
[
|
||||
|
|
@ -210,10 +214,12 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return $acl;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChildACL() {
|
||||
return $this->getACL();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner(): ?string {
|
||||
if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}owner-principal'];
|
||||
|
|
@ -221,6 +227,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return parent::getOwner();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function delete() {
|
||||
if ($this->isShared()) {
|
||||
$this->caldavBackend->unshare($this, 'principal:' . $this->getPrincipalURI());
|
||||
|
|
@ -242,6 +249,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function propPatch(PropPatch $propPatch) {
|
||||
// parent::propPatch will only update calendars table
|
||||
// if calendar is shared, changes have to be made to the properties table
|
||||
|
|
@ -250,6 +258,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, $this->getCalendarType());
|
||||
|
||||
|
|
@ -266,6 +275,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChildren() {
|
||||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], $this->getCalendarType());
|
||||
$children = [];
|
||||
|
|
@ -279,6 +289,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return $children;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getMultipleChildren(array $paths) {
|
||||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, $this->getCalendarType());
|
||||
$children = [];
|
||||
|
|
@ -292,6 +303,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return $children;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function childExists($name) {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name, $this->getCalendarType());
|
||||
if (!$obj) {
|
||||
|
|
@ -304,6 +316,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function calendarQuery(array $filters) {
|
||||
$uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters, $this->getCalendarType());
|
||||
if ($this->isShared()) {
|
||||
|
|
@ -369,6 +382,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChanges($syncToken, $syncLevel, $limit = null) {
|
||||
if (!$syncToken && $limit) {
|
||||
throw new UnsupportedLimitOnInitialSyncException();
|
||||
|
|
@ -380,6 +394,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function restore(): void {
|
||||
$this->caldavBackend->restoreCalendar((int)$this->calendarInfo['id']);
|
||||
}
|
||||
|
|
@ -391,6 +406,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function moveInto($targetName, $sourcePath, INode $sourceNode) {
|
||||
if (!($sourceNode instanceof CalendarObject)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function createExtendedCollection($name, MkCol $mkCol): void {
|
||||
$reservedNames = [
|
||||
BirthdayService::BIRTHDAY_CALENDAR_URI,
|
||||
|
|
@ -83,6 +84,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren() {
|
||||
if ($this->cachedChildren) {
|
||||
return $this->cachedChildren;
|
||||
|
|
@ -144,6 +146,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
|||
*
|
||||
* @return INode
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
// Special nodes
|
||||
if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
* @return string defining the technical unique key
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getKey(): string {
|
||||
return (string)$this->calendarInfo['id'];
|
||||
}
|
||||
|
|
@ -56,6 +57,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function getUri(): string {
|
||||
return $this->calendarInfo['uri'];
|
||||
}
|
||||
|
|
@ -72,6 +74,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
* In comparison to getKey() this function returns a human readable (maybe translated) name
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getDisplayName(): ?string {
|
||||
return $this->calendarInfo['{DAV:}displayname'];
|
||||
}
|
||||
|
|
@ -80,6 +83,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
* Calendar color
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getDisplayColor(): ?string {
|
||||
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
|
||||
}
|
||||
|
|
@ -107,6 +111,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
return $vtimezone;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array {
|
||||
return $this->backend->search($this->calendarInfo, $pattern,
|
||||
$searchProperties, $options, $limit, $offset);
|
||||
|
|
@ -116,6 +121,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
* @return int build up using \OCP\Constants
|
||||
* @since 13.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPermissions(): int {
|
||||
$permissions = $this->calendar->getACL();
|
||||
$result = 0;
|
||||
|
|
@ -144,6 +150,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* @since 32.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isEnabled(): bool {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true;
|
||||
}
|
||||
|
|
@ -151,6 +158,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* @since 31.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isWritable(): bool {
|
||||
return $this->calendar->canWrite();
|
||||
}
|
||||
|
|
@ -158,6 +166,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* @since 26.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isDeleted(): bool {
|
||||
return $this->calendar->isDeleted();
|
||||
}
|
||||
|
|
@ -165,6 +174,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* @since 31.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function isShared(): bool {
|
||||
return $this->calendar->isShared();
|
||||
}
|
||||
|
|
@ -172,6 +182,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* @since 33.0.1, 32.0.7, 31.0.14.1, 30.0.17.8
|
||||
*/
|
||||
#[\Override]
|
||||
public function getPublicToken(): ?string {
|
||||
return $this->calendar->getPublishStatus() ?: null;
|
||||
}
|
||||
|
|
@ -216,11 +227,13 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function createFromString(string $name, string $calendarData): void {
|
||||
$server = new EmbeddedCalDavServer(false);
|
||||
$this->createFromStringInServer($name, $calendarData, $server->getServer());
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function createFromStringMinimal(string $name, string $calendarData): void {
|
||||
$server = new InvitationResponseServer(false);
|
||||
$this->createFromStringInServer($name, $calendarData, $server->getServer());
|
||||
|
|
@ -229,6 +242,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
/**
|
||||
* @throws CalendarException
|
||||
*/
|
||||
#[\Override]
|
||||
public function handleIMipMessage(string $name, string $calendarData): void {
|
||||
|
||||
try {
|
||||
|
|
@ -330,6 +344,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIs
|
|||
*
|
||||
* @return Generator<mixed, \Sabre\VObject\Component\VCalendar, mixed, mixed>
|
||||
*/
|
||||
#[\Override]
|
||||
public function export(?CalendarExportOptions $options = null): Generator {
|
||||
foreach (
|
||||
$this->backend->exportCalendar(
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function get() {
|
||||
$data = parent::get();
|
||||
|
||||
|
|
@ -148,6 +149,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
|||
return $this->calendarInfo['principaluri'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner(): ?string {
|
||||
if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}owner-principal'];
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class CalendarProvider implements ICalendarProvider {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getCalendars(string $principalUri, array $calendarUris = []): array {
|
||||
/** @var array{uri: string, principaluri: string}[] $calendarInfos */
|
||||
$calendarInfos = $this->calDavBackend->getCalendarsForUser($principalUri) ?? [];
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
|||
parent::__construct($principalBackend, $caldavBackend, $principalPrefix);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChildForPrincipal(array $principal) {
|
||||
[$prefix] = \Sabre\Uri\split($principal['uri']);
|
||||
if ($prefix === RemoteUserPrincipalBackend::PRINCIPAL_PREFIX) {
|
||||
|
|
@ -54,6 +55,7 @@ class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
|||
);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName() {
|
||||
if ($this->principalPrefix === 'principals/calendar-resources'
|
||||
|| $this->principalPrefix === 'principals/calendar-rooms') {
|
||||
|
|
@ -73,6 +75,7 @@ class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
|||
$this->returnCachedSubscriptions['principals/users/' . $principalUri] = true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function childExists($name) {
|
||||
if (!($this->principalBackend instanceof Principal)) {
|
||||
return parent::childExists($name);
|
||||
|
|
|
|||
|
|
@ -39,10 +39,12 @@ class CalendarFederationProvider implements ICloudFederationProvider {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getShareType(): string {
|
||||
return self::PROVIDER_ID;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function shareReceived(ICloudFederationShare $share): string {
|
||||
if (!$this->calendarFederationConfig->isFederationEnabled()) {
|
||||
$this->logger->debug('Received a federation invite but federation is disabled');
|
||||
|
|
@ -152,6 +154,7 @@ class CalendarFederationProvider implements ICloudFederationProvider {
|
|||
return (string)$calendar->getId();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function notificationReceived(
|
||||
$notificationType,
|
||||
$providerId,
|
||||
|
|
@ -172,6 +175,7 @@ class CalendarFederationProvider implements ICloudFederationProvider {
|
|||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getSupportedShareTypes(): array {
|
||||
return [self::USER_SHARE_TYPE];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
return $this->federationInfo->getId();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->federationInfo->getUri();
|
||||
}
|
||||
|
|
@ -54,6 +55,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @param string $name Name of the file
|
||||
*/
|
||||
#[\Override]
|
||||
public function setName($name): void {
|
||||
throw new MethodNotAllowed('Renaming federated calendars is not allowed');
|
||||
}
|
||||
|
|
@ -66,10 +68,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
return $this->federationInfo->getPrincipaluri();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner(): ?string {
|
||||
return $this->federationInfo->getSharedByPrincipal();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroup(): ?string {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -77,6 +81,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @return array<array-key, mixed>
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL(): array {
|
||||
if ($this->calendarACL !== null) {
|
||||
return $this->calendarACL;
|
||||
|
|
@ -135,10 +140,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
return $acl;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function setACL(array $acl): void {
|
||||
throw new MethodNotAllowed('Changing ACLs on federated calendars is not allowed');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getSupportedPrivilegeSet(): ?array {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -146,6 +153,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @return array<string, mixed> properties array, with property name as key
|
||||
*/
|
||||
#[\Override]
|
||||
public function getProperties($properties): array {
|
||||
return [
|
||||
self::DAV_PROPERTY_CALENDAR_LABEL => $this->federationInfo->getDisplayName(),
|
||||
|
|
@ -154,6 +162,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function propPatch(PropPatch $propPatch): void {
|
||||
$mutations = $propPatch->getMutations();
|
||||
if (count($mutations) > 0) {
|
||||
|
|
@ -176,10 +185,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
return $this->getACL();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getLastModified(): ?int {
|
||||
return $this->federationInfo->getLastSync();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function delete(): void {
|
||||
$this->federatedCalendarMapper->deleteById($this->getResourceId());
|
||||
}
|
||||
|
|
@ -187,10 +198,12 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @param string $name Name of the file
|
||||
*/
|
||||
#[\Override]
|
||||
public function createDirectory($name): void {
|
||||
throw new MethodNotAllowed('Creating nested collection is not allowed');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function calendarQuery(array $filters): array {
|
||||
$uris = $this->caldavBackend->calendarQuery($this->federationInfo->getId(), $filters, $this->getCalendarType());
|
||||
return $uris;
|
||||
|
|
@ -199,6 +212,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @param string $name Name of the file
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChild($name): INode {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->federationInfo->getId(), $name, $this->getCalendarType());
|
||||
|
||||
|
|
@ -212,6 +226,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @return array<INode>
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren(): array {
|
||||
$objs = $this->caldavBackend->getCalendarObjects($this->federationInfo->getId(), $this->getCalendarType());
|
||||
|
||||
|
|
@ -228,6 +243,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
*
|
||||
* @return array<INode>
|
||||
*/
|
||||
#[\Override]
|
||||
public function getMultipleChildren(array $paths): array {
|
||||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->federationInfo->getId(), $paths, $this->getCalendarType());
|
||||
|
||||
|
|
@ -242,6 +258,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
/**
|
||||
* @param string $name Name of the file
|
||||
*/
|
||||
#[\Override]
|
||||
public function childExists($name): bool {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->federationInfo->getId(), $name, $this->getCalendarType());
|
||||
return $obj !== null;
|
||||
|
|
@ -251,6 +268,7 @@ class FederatedCalendar implements ICalendar, IProperties, IMultiGet {
|
|||
* @param string $name Name of the file
|
||||
* @param resource|string $data Initial payload
|
||||
*/
|
||||
#[\Override]
|
||||
public function createFile($name, $data = null): string {
|
||||
if (is_resource($data)) {
|
||||
$data = stream_get_contents($data);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ class FederatedCalendarAuth implements BackendInterface {
|
|||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function check(RequestInterface $request, ResponseInterface $response): array {
|
||||
if (!str_starts_with($request->getPath(), 'remote-calendars/')) {
|
||||
return [false, 'This request is not for a federated calendar'];
|
||||
|
|
@ -75,6 +76,7 @@ class FederatedCalendarAuth implements BackendInterface {
|
|||
return [true, $principal];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function challenge(RequestInterface $request, ResponseInterface $response): void {
|
||||
// No special challenge is needed here
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,22 +23,27 @@ class FederatedCalendarImpl implements ICalendar, ICalendarIsShared, ICalendarIs
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getKey(): string {
|
||||
return (string)$this->calendarInfo['id'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getUri(): string {
|
||||
return $this->calendarInfo['uri'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getDisplayName(): ?string {
|
||||
return $this->calendarInfo['{DAV:}displayname'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getDisplayColor(): ?string {
|
||||
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array {
|
||||
return $this->calDavBackend->search(
|
||||
$this->calendarInfo,
|
||||
|
|
@ -50,23 +55,28 @@ class FederatedCalendarImpl implements ICalendar, ICalendarIsShared, ICalendarIs
|
|||
);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getPermissions(): int {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}permissions'] ?? Constants::PERMISSION_READ;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isDeleted(): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isShared(): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isWritable(): bool {
|
||||
$permissions = $this->getPermissions();
|
||||
return ($permissions & Constants::PERMISSION_UPDATE) !== 0;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function isEnabled(): bool {
|
||||
return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->objectData['uri'];
|
||||
}
|
||||
|
|
@ -28,10 +29,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
/**
|
||||
* @param string $name Name of the file
|
||||
*/
|
||||
#[\Override]
|
||||
public function setName($name) {
|
||||
throw new \Exception('Not implemented');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get(): string {
|
||||
return $this->objectData['calendardata'];
|
||||
}
|
||||
|
|
@ -39,6 +42,7 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
/**
|
||||
* @param resource|string $data contents of the file
|
||||
*/
|
||||
#[\Override]
|
||||
public function put($data): string {
|
||||
|
||||
$etag = $this->calendarObject->updateFile($this->objectData['uri'], $data);
|
||||
|
|
@ -48,10 +52,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
return $etag;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function delete(): void {
|
||||
$this->calendarObject->deleteFile($this->objectData['uri']);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getContentType(): ?string {
|
||||
$mime = 'text/calendar; charset=utf-8';
|
||||
if (isset($this->objectData['component']) && $this->objectData['component']) {
|
||||
|
|
@ -61,6 +67,7 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
return $mime;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getETag(): string {
|
||||
if (isset($this->objectData['etag'])) {
|
||||
return $this->objectData['etag'];
|
||||
|
|
@ -69,10 +76,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getLastModified(): int {
|
||||
return $this->objectData['lastmodified'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getSize(): int {
|
||||
if (isset($this->objectData['size'])) {
|
||||
return $this->objectData['size'];
|
||||
|
|
@ -81,10 +90,12 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
}
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getOwner(): ?string {
|
||||
return $this->calendarObject->getPrincipalURI();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getGroup(): ?string {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -92,14 +103,17 @@ class FederatedCalendarObject implements ICalendarObject, IACL {
|
|||
/**
|
||||
* @return array<array-key, mixed>
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL(): array {
|
||||
return $this->calendarObject->getACL();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function setACL(array $acl): void {
|
||||
throw new MethodNotAllowed('Changing ACLs on federated events is not allowed');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getSupportedPrivilegeSet(): ?array {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class RemoteUserCalendarHome extends CalendarHome {
|
|||
parent::__construct($caldavBackend, $principalInfo);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
// Remote users can only have incoming shared calendars so we can skip the rest of a regular
|
||||
// calendar home
|
||||
|
|
@ -46,6 +47,7 @@ class RemoteUserCalendarHome extends CalendarHome {
|
|||
throw new NotFound("Node with name $name could not be found");
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getChildren(): array {
|
||||
$objects = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response) {
|
||||
if (!isset($properties['{http://nextcloud.com/ns}refresh-interval'])) {
|
||||
$value = $this->config->getAppValue('dav', 'defaultRefreshIntervalExportedCalendars', self::DEFAULT_REFRESH_INTERVAL);
|
||||
|
|
@ -46,6 +47,7 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function mergeObjects(array $properties, array $inputObjects) {
|
||||
$vcalendar = parent::mergeObjects($properties, $inputObjects);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
final public function getName() {
|
||||
return implode(self::DELIMITER, [
|
||||
self::PREFIX,
|
||||
|
|
@ -61,6 +62,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
final public function setName($name) {
|
||||
throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported');
|
||||
}
|
||||
|
|
@ -68,6 +70,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
final public function createDirectory($name) {
|
||||
throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class Outbox extends \Sabre\CalDAV\Schedule\Outbox {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL() {
|
||||
// getACL is called so frequently that we cache the config result
|
||||
if ($this->disableFreeBusy === null) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class Plugin extends \Sabre\CalDAV\Plugin {
|
|||
* @param string $principalUrl
|
||||
* @return string|null
|
||||
*/
|
||||
#[\Override]
|
||||
public function getCalendarHomeForPrincipal($principalUrl) {
|
||||
if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
|
||||
[, $principalId] = \Sabre\Uri\split($principalUrl);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Collection extends \Sabre\CalDAV\Principal\Collection {
|
|||
* @param array $principalInfo
|
||||
* @return User
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildForPrincipal(array $principalInfo) {
|
||||
return new User($this->principalBackend, $principalInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class ProxyRead extends \Sabre\CalDAV\Principal\ProxyRead implements DAVACL\IACL
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getOwner() {
|
||||
return $this->principalInfo['uri'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class ProxyWrite extends \Sabre\CalDAV\Principal\ProxyWrite implements DAVACL\IA
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\Override]
|
||||
public function getOwner() {
|
||||
return $this->principalInfo['uri'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class User extends \Sabre\CalDAV\Principal\User {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
public function getACL() {
|
||||
$acl = parent::getACL();
|
||||
$acl[] = [
|
||||
|
|
@ -44,6 +45,7 @@ class User extends \Sabre\CalDAV\Principal\User {
|
|||
*
|
||||
* @return \Sabre\DAV\INode
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
$principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/' . $name);
|
||||
if (!$principal) {
|
||||
|
|
@ -65,6 +67,7 @@ class User extends \Sabre\CalDAV\Principal\User {
|
|||
*
|
||||
* @return \Sabre\DAV\INode[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren() {
|
||||
$r = [];
|
||||
if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-read')) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class PublicCalendar extends Calendar {
|
|||
* @throws NotFound
|
||||
* @return PublicCalendarObject
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChild($name) {
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ class PublicCalendar extends Calendar {
|
|||
/**
|
||||
* @return PublicCalendarObject[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getChildren() {
|
||||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
|
||||
$children = [];
|
||||
|
|
@ -49,6 +51,7 @@ class PublicCalendar extends Calendar {
|
|||
* @param string[] $paths
|
||||
* @return PublicCalendarObject[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getMultipleChildren(array $paths) {
|
||||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
|
||||
$children = [];
|
||||
|
|
@ -66,6 +69,7 @@ class PublicCalendar extends Calendar {
|
|||
* public calendars are always shared
|
||||
* @return bool
|
||||
*/
|
||||
#[\Override]
|
||||
public function isShared() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class PublicCalendarObject extends CalendarObject {
|
|||
* public calendars are always shared
|
||||
* @return bool
|
||||
*/
|
||||
#[\Override]
|
||||
protected function isShared() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue