aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/composer/composer/autoload_classmap.php1
-rw-r--r--apps/dav/composer/composer/autoload_static.php1
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php19
-rw-r--r--apps/dav/lib/CalDAV/CalendarImpl.php5
-rw-r--r--apps/dav/lib/CalDAV/CalendarProvider.php72
-rw-r--r--apps/dav/lib/RootCollection.php1
-rw-r--r--apps/settings/l10n/eu.js1
-rw-r--r--apps/settings/l10n/eu.json1
-rw-r--r--apps/theming/lib/Controller/ThemingController.php2
-rw-r--r--apps/theming/lib/ThemingDefaults.php19
-rw-r--r--apps/updatenotification/lib/Controller/APIController.php34
-rw-r--r--apps/updatenotification/lib/Notification/Notifier.php6
-rw-r--r--build/psalm-baseline.xml3
-rw-r--r--config/config.sample.php13
-rw-r--r--lib/composer/composer/autoload_classmap.php3
-rw-r--r--lib/composer/composer/autoload_static.php3
-rw-r--r--lib/private/AppFramework/Bootstrap/RegistrationContext.php22
-rw-r--r--lib/private/Authentication/Token/DefaultTokenProvider.php13
-rw-r--r--lib/private/Authentication/Token/IProvider.php2
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php2
-rw-r--r--lib/private/Calendar/CalendarQuery.php124
-rw-r--r--lib/private/Calendar/Manager.php50
-rw-r--r--lib/private/Installer.php6
-rw-r--r--lib/private/Share20/DefaultShareProvider.php2
-rw-r--r--lib/private/legacy/OC_App.php5
-rw-r--r--lib/private/legacy/OC_User.php4
-rw-r--r--lib/public/AppFramework/Bootstrap/IRegistrationContext.php9
-rw-r--r--lib/public/Calendar/ICalendar.php3
-rw-r--r--lib/public/Calendar/ICalendarProvider.php45
-rw-r--r--lib/public/Calendar/ICalendarQuery.php82
-rw-r--r--lib/public/Calendar/IManager.php29
-rw-r--r--lib/public/Share/Exceptions/ShareNotFound.php14
-rw-r--r--lib/public/User/Events/UserLoggedInEvent.php6
-rw-r--r--tests/lib/Calendar/ManagerTest.php29
34 files changed, 557 insertions, 74 deletions
diff --git a/apps/dav/composer/composer/autoload_classmap.php b/apps/dav/composer/composer/autoload_classmap.php
index 0572fe3cff8..daf2cff3161 100644
--- a/apps/dav/composer/composer/autoload_classmap.php
+++ b/apps/dav/composer/composer/autoload_classmap.php
@@ -43,6 +43,7 @@ return array(
'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir . '/../lib/CalDAV/CalendarImpl.php',
'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir . '/../lib/CalDAV/CalendarManager.php',
'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir . '/../lib/CalDAV/CalendarObject.php',
+ 'OCA\\DAV\\CalDAV\\CalendarProvider' => $baseDir . '/../lib/CalDAV/CalendarProvider.php',
'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir . '/../lib/CalDAV/CalendarRoot.php',
'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
'OCA\\DAV\\CalDAV\\IRestorable' => $baseDir . '/../lib/CalDAV/IRestorable.php',
diff --git a/apps/dav/composer/composer/autoload_static.php b/apps/dav/composer/composer/autoload_static.php
index 01a5df8c1b8..d00299ed047 100644
--- a/apps/dav/composer/composer/autoload_static.php
+++ b/apps/dav/composer/composer/autoload_static.php
@@ -58,6 +58,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarImpl.php',
'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarManager.php',
'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarObject.php',
+ 'OCA\\DAV\\CalDAV\\CalendarProvider' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarProvider.php',
'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarRoot.php',
'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
'OCA\\DAV\\CalDAV\\IRestorable' => __DIR__ . '/..' . '/../lib/CalDAV/IRestorable.php',
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 5f0c1bf3c48..64ee76f94d1 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -1845,17 +1845,19 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
// only return public items for shared calendars for now
- if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
+ if (isset($calendarInfo['{http://owncloud.org/ns}owner-principal']) === false || $calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
$innerQuery->andWhere($innerQuery->expr()->eq('c.classification',
$outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
}
- $or = $innerQuery->expr()->orX();
- foreach ($searchProperties as $searchProperty) {
- $or->add($innerQuery->expr()->eq('op.name',
- $outerQuery->createNamedParameter($searchProperty)));
+ if (!empty($searchProperties)) {
+ $or = $innerQuery->expr()->orX();
+ foreach ($searchProperties as $searchProperty) {
+ $or->add($innerQuery->expr()->eq('op.name',
+ $outerQuery->createNamedParameter($searchProperty)));
+ }
+ $innerQuery->andWhere($or);
}
- $innerQuery->andWhere($or);
if ($pattern !== '') {
$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
@@ -1878,7 +1880,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
}
- if (isset($options['types'])) {
+ if (!empty($options['types'])) {
$or = $outerQuery->expr()->orX();
foreach ($options['types'] as $type) {
$or->add($outerQuery->expr()->eq('componenttype',
@@ -1887,8 +1889,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$outerQuery->andWhere($or);
}
- $outerQuery->andWhere($outerQuery->expr()->in('c.id',
- $outerQuery->createFunction($innerQuery->getSQL())));
+ $outerQuery->andWhere($outerQuery->expr()->in('c.id', $outerQuery->createFunction($innerQuery->getSQL())));
if ($offset) {
$outerQuery->setFirstResult($offset);
diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php
index 4f34e604c81..356f2800031 100644
--- a/apps/dav/lib/CalDAV/CalendarImpl.php
+++ b/apps/dav/lib/CalDAV/CalendarImpl.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
*
@@ -51,7 +54,7 @@ class CalendarImpl implements ICalendar {
$this->calendarInfo = $calendarInfo;
$this->backend = $backend;
}
-
+
/**
* @return string defining the technical unique key
* @since 13.0.0
diff --git a/apps/dav/lib/CalDAV/CalendarProvider.php b/apps/dav/lib/CalDAV/CalendarProvider.php
new file mode 100644
index 00000000000..30eb6ae4268
--- /dev/null
+++ b/apps/dav/lib/CalDAV/CalendarProvider.php
@@ -0,0 +1,72 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2021 Anna Larch <anna.larch@gmx.net>
+ *
+ * @author Anna Larch <anna.larch@gmx.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OCA\DAV\CalDAV;
+
+use OCP\Calendar\ICalendarProvider;
+use OCP\IConfig;
+use OCP\IL10N;
+
+class CalendarProvider implements ICalendarProvider {
+
+ /** @var CalDavBackend */
+ private $calDavBackend;
+
+ /** @var IL10N */
+ private $l10n;
+
+ /** @var IConfig */
+ private $config;
+
+ public function __construct(CalDavBackend $calDavBackend, IL10N $l10n, IConfig $config) {
+ $this->calDavBackend = $calDavBackend;
+ $this->l10n = $l10n;
+ $this->config = $config;
+ }
+
+ public function getCalendars(string $principalUri, array $calendarUris = []): array {
+ $calendarInfos = [];
+ if (empty($calendarUris)) {
+ $calendarInfos[] = $this->calDavBackend->getCalendarsForUser($principalUri);
+ } else {
+ foreach ($calendarUris as $calendarUri) {
+ $calendarInfos[] = $this->calDavBackend->getCalendarByUri($principalUri, $calendarUri);
+ }
+ }
+
+ $calendarInfos = array_filter($calendarInfos);
+
+ $iCalendars = [];
+ foreach ($calendarInfos as $calendarInfo) {
+ $calendar = new Calendar($this->calDavBackend, $calendarInfo, $this->l10n, $this->config);
+ $iCalendars[] = new CalendarImpl(
+ $calendar,
+ $calendarInfo,
+ $this->calDavBackend,
+ );
+ }
+ return $iCalendars;
+ }
+}
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php
index 8d921414d51..d307b5d2488 100644
--- a/apps/dav/lib/RootCollection.php
+++ b/apps/dav/lib/RootCollection.php
@@ -51,7 +51,6 @@ use Sabre\DAV\SimpleCollection;
class RootCollection extends SimpleCollection {
public function __construct() {
- $config = \OC::$server->getConfig();
$l10n = \OC::$server->getL10N('dav');
$random = \OC::$server->getSecureRandom();
$logger = \OC::$server->getLogger();
diff --git a/apps/settings/l10n/eu.js b/apps/settings/l10n/eu.js
index 71215194028..b5159ace24a 100644
--- a/apps/settings/l10n/eu.js
+++ b/apps/settings/l10n/eu.js
@@ -137,6 +137,7 @@ OC.L10N.register(
"MySQL version \"%s\" is used. Nextcloud 21 will no longer support this version and requires MySQL 8.0 or MariaDB 10.2 or higher." : "MySQL \"%s\" bertsioa erabiltzen da. Nextcloud 21-ek ez du bertsio hau onartzen eta MySQL 8.0 edo MariaDB 10.2 edo berriagoa behar du.",
"PostgreSQL version \"%s\" is used. Nextcloud 21 will no longer support this version and requires PostgreSQL 9.6 or higher." : "PostgreSQL \"%s\" bertsioa erabiltzen da. Nextcloud 21-ek ez du bertsio hau onartzen eta PostgreSQL 9.6 edo berriagoa behar du.",
"Nextcloud settings" : "Nextcloud ezarpenak",
+ "Administration privileges" : "Administrazio pribilegioak",
"None" : "Bat ere ez",
"Unable to modify setting" : "Ezin izan da ezarpena aldatu",
"Two-factor authentication can be enforced for all users and specific groups. If they do not have a two-factor provider configured, they will be unable to log into the system." : "Bi faktoreko autentifikazioa erabiltzaile guztientzat edo talde batzuentzat ezarri daiteke. Ez badute bi faktoreko hornitzailerik konfiguratuta, ezingo dira sistemara sartu.",
diff --git a/apps/settings/l10n/eu.json b/apps/settings/l10n/eu.json
index 2a1d2f0f951..cef09090bd5 100644
--- a/apps/settings/l10n/eu.json
+++ b/apps/settings/l10n/eu.json
@@ -135,6 +135,7 @@
"MySQL version \"%s\" is used. Nextcloud 21 will no longer support this version and requires MySQL 8.0 or MariaDB 10.2 or higher." : "MySQL \"%s\" bertsioa erabiltzen da. Nextcloud 21-ek ez du bertsio hau onartzen eta MySQL 8.0 edo MariaDB 10.2 edo berriagoa behar du.",
"PostgreSQL version \"%s\" is used. Nextcloud 21 will no longer support this version and requires PostgreSQL 9.6 or higher." : "PostgreSQL \"%s\" bertsioa erabiltzen da. Nextcloud 21-ek ez du bertsio hau onartzen eta PostgreSQL 9.6 edo berriagoa behar du.",
"Nextcloud settings" : "Nextcloud ezarpenak",
+ "Administration privileges" : "Administrazio pribilegioak",
"None" : "Bat ere ez",
"Unable to modify setting" : "Ezin izan da ezarpena aldatu",
"Two-factor authentication can be enforced for all users and specific groups. If they do not have a two-factor provider configured, they will be unable to log into the system." : "Bi faktoreko autentifikazioa erabiltzaile guztientzat edo talde batzuentzat ezarri daiteke. Ez badute bi faktoreko hornitzailerik konfiguratuta, ezingo dira sistemara sartu.",
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 270181e42d2..6d4bd4bae60 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -378,7 +378,7 @@ class ThemingController extends Controller {
$startUrl = $this->urlGenerator->getBaseUrl();
$description = $this->themingDefaults->getSlogan();
} else {
- $info = $this->appManager->getAppInfo($app);
+ $info = $this->appManager->getAppInfo($app, false, $this->l10n->getLanguageCode());
$name = $info['name'] . ' - ' . $this->themingDefaults->getName();
$shortName = $info['name'];
if (strpos($this->request->getRequestUri(), '/index.php/') !== false) {
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 1f44c237182..3bfccda4a43 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -43,6 +43,7 @@ namespace OCA\Theming;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\Files\NotFoundException;
+use OCP\Files\SimpleFS\ISimpleFile;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IL10N;
@@ -363,17 +364,11 @@ class ThemingDefaults extends \OC_Defaults {
}
$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
- try {
- $customFavicon = $this->imageManager->getImage('favicon');
- } catch (NotFoundException $e) {
- $customFavicon = null;
- }
-
$route = false;
- if ($image === 'favicon.ico' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) {
+ if ($image === 'favicon.ico' && ($this->imageManager->shouldReplaceIcons() || $this->getCustomFavicon() !== null)) {
$route = $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]);
}
- if (($image === 'favicon-touch.png' || $image === 'favicon-fb.png') && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) {
+ if (($image === 'favicon-touch.png' || $image === 'favicon-fb.png') && ($this->imageManager->shouldReplaceIcons() || $this->getCustomFavicon() !== null)) {
$route = $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]);
}
if ($image === 'manifest.json') {
@@ -397,6 +392,14 @@ class ThemingDefaults extends \OC_Defaults {
return false;
}
+ protected function getCustomFavicon(): ?ISimpleFile {
+ try {
+ return $this->imageManager->getImage('favicon');
+ } catch (NotFoundException $e) {
+ return null;
+ }
+ }
+
/**
* Increases the cache buster key
*/
diff --git a/apps/updatenotification/lib/Controller/APIController.php b/apps/updatenotification/lib/Controller/APIController.php
index b4c304a6120..9d5d1c2d764 100644
--- a/apps/updatenotification/lib/Controller/APIController.php
+++ b/apps/updatenotification/lib/Controller/APIController.php
@@ -34,6 +34,8 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\IConfig;
use OCP\IRequest;
+use OCP\IUserSession;
+use OCP\L10N\IFactory;
class APIController extends OCSController {
@@ -46,23 +48,29 @@ class APIController extends OCSController {
/** @var AppFetcher */
protected $appFetcher;
- /**
- * @param string $appName
- * @param IRequest $request
- * @param IConfig $config
- * @param IAppManager $appManager
- * @param AppFetcher $appFetcher
- */
- public function __construct($appName,
+ /** @var IFactory */
+ protected $l10nFactory;
+
+ /** @var IUserSession */
+ protected $userSession;
+
+ /** @var string */
+ protected $language;
+
+ public function __construct(string $appName,
IRequest $request,
IConfig $config,
IAppManager $appManager,
- AppFetcher $appFetcher) {
+ AppFetcher $appFetcher,
+ IFactory $l10nFactory,
+ IUserSession $userSession) {
parent::__construct($appName, $request);
$this->config = $config;
$this->appManager = $appManager;
$this->appFetcher = $appFetcher;
+ $this->l10nFactory = $l10nFactory;
+ $this->userSession = $userSession;
}
/**
@@ -97,7 +105,7 @@ class APIController extends OCSController {
$this->appFetcher->setVersion($newVersion, 'future-apps.json', false);
// Apps available on the app store for that version
- $availableApps = array_map(function (array $app) {
+ $availableApps = array_map(static function (array $app) {
return $app['id'];
}, $this->appFetcher->get());
@@ -108,6 +116,8 @@ class APIController extends OCSController {
], Http::STATUS_NOT_FOUND);
}
+ $this->language = $this->l10nFactory->getUserLanguage($this->userSession->getUser());
+
$missing = array_diff($installedApps, $availableApps);
$missing = array_map([$this, 'getAppDetails'], $missing);
sort($missing);
@@ -128,8 +138,8 @@ class APIController extends OCSController {
* @param string $appId
* @return string[]
*/
- protected function getAppDetails($appId): array {
- $app = $this->appManager->getAppInfo($appId);
+ protected function getAppDetails(string $appId): array {
+ $app = $this->appManager->getAppInfo($appId, false, $this->language);
return [
'appId' => $appId,
'appName' => $app['name'] ?? $appId,
diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php
index 787a43b2db8..bfbcc203480 100644
--- a/apps/updatenotification/lib/Notification/Notifier.php
+++ b/apps/updatenotification/lib/Notification/Notifier.php
@@ -134,7 +134,7 @@ class Notifier implements INotifier {
$notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
}
} else {
- $appInfo = $this->getAppInfo($notification->getObjectType());
+ $appInfo = $this->getAppInfo($notification->getObjectType(), $languageCode);
$appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name'];
if (isset($this->appVersions[$notification->getObjectType()])) {
@@ -194,7 +194,7 @@ class Notifier implements INotifier {
return \OC_App::getAppVersions();
}
- protected function getAppInfo($appId) {
- return \OC_App::getAppInfo($appId);
+ protected function getAppInfo($appId, $languageCode) {
+ return \OC_App::getAppInfo($appId, false, $languageCode);
}
}
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 0da1c8fc179..4c0586d842c 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -4151,8 +4151,7 @@
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|string</code>
</ImplementedReturnTypeMismatch>
- <LessSpecificImplementedReturnType occurrences="2">
- <code>array</code>
+ <LessSpecificImplementedReturnType occurrences="1">
<code>array|mixed</code>
</LessSpecificImplementedReturnType>
</file>
diff --git a/config/config.sample.php b/config/config.sample.php
index 845db00ac12..dba68ba296d 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -108,7 +108,7 @@ $CONFIG = [
* Your host server name, for example ``localhost``, ``hostname``,
* ``hostname.example.com``, or the IP address. To specify a port use
* ``hostname:####``; to specify a Unix socket use
- * ``localhost:/path/to/socket``.
+ * ``/path/to/directory/containing/socket`` e.g. ``/run/postgresql/``.
*/
'dbhost' => '',
@@ -1965,4 +1965,15 @@ $CONFIG = [
*/
'login_form_autocomplete' => true,
+
+/**
+ * Disable background scanning of files
+ *
+ * By default, a background job runs every 10 minutes and execute a background
+ * scan to sync filesystem and database. Only users with unscanned files
+ * (size=0 in filecache) are included. Maximum 500 users per job.
+ *
+ * Defaults to ``true``
+ */
+'files_no_background_scan' => false,
];
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 823eef1fde3..353fc22d486 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -117,6 +117,8 @@ return array(
'OCP\\Broadcast\\Events\\IBroadcastEvent' => $baseDir . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
'OCP\\Calendar\\ICalendar' => $baseDir . '/lib/public/Calendar/ICalendar.php',
+ 'OCP\\Calendar\\ICalendarProvider' => $baseDir . '/lib/public/Calendar/ICalendarProvider.php',
+ 'OCP\\Calendar\\ICalendarQuery' => $baseDir . '/lib/public/Calendar/ICalendarQuery.php',
'OCP\\Calendar\\IManager' => $baseDir . '/lib/public/Calendar/IManager.php',
'OCP\\Calendar\\IMetadataProvider' => $baseDir . '/lib/public/Calendar/IMetadataProvider.php',
'OCP\\Calendar\\Resource\\IBackend' => $baseDir . '/lib/public/Calendar/Resource/IBackend.php',
@@ -759,6 +761,7 @@ return array(
'OC\\Broadcast\\Events\\BroadcastEvent' => $baseDir . '/lib/private/Broadcast/Events/BroadcastEvent.php',
'OC\\Cache\\CappedMemoryCache' => $baseDir . '/lib/private/Cache/CappedMemoryCache.php',
'OC\\Cache\\File' => $baseDir . '/lib/private/Cache/File.php',
+ 'OC\\Calendar\\CalendarQuery' => $baseDir . '/lib/private/Calendar/CalendarQuery.php',
'OC\\Calendar\\Manager' => $baseDir . '/lib/private/Calendar/Manager.php',
'OC\\Calendar\\Resource\\Manager' => $baseDir . '/lib/private/Calendar/Resource/Manager.php',
'OC\\Calendar\\Room\\Manager' => $baseDir . '/lib/private/Calendar/Room/Manager.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 81cd22b0570..f7c541d8c31 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -146,6 +146,8 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Broadcast\\Events\\IBroadcastEvent' => __DIR__ . '/../../..' . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
'OCP\\Calendar\\ICalendar' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendar.php',
+ 'OCP\\Calendar\\ICalendarProvider' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarProvider.php',
+ 'OCP\\Calendar\\ICalendarQuery' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarQuery.php',
'OCP\\Calendar\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/IManager.php',
'OCP\\Calendar\\IMetadataProvider' => __DIR__ . '/../../..' . '/lib/public/Calendar/IMetadataProvider.php',
'OCP\\Calendar\\Resource\\IBackend' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IBackend.php',
@@ -788,6 +790,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Broadcast\\Events\\BroadcastEvent' => __DIR__ . '/../../..' . '/lib/private/Broadcast/Events/BroadcastEvent.php',
'OC\\Cache\\CappedMemoryCache' => __DIR__ . '/../../..' . '/lib/private/Cache/CappedMemoryCache.php',
'OC\\Cache\\File' => __DIR__ . '/../../..' . '/lib/private/Cache/File.php',
+ 'OC\\Calendar\\CalendarQuery' => __DIR__ . '/../../..' . '/lib/private/Calendar/CalendarQuery.php',
'OC\\Calendar\\Manager' => __DIR__ . '/../../..' . '/lib/private/Calendar/Manager.php',
'OC\\Calendar\\Resource\\Manager' => __DIR__ . '/../../..' . '/lib/private/Calendar/Resource/Manager.php',
'OC\\Calendar\\Room\\Manager' => __DIR__ . '/../../..' . '/lib/private/Calendar/Room/Manager.php',
diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
index 30ac63281d1..8eed6a5bde4 100644
--- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php
+++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
@@ -35,6 +35,7 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Services\InitialStateProvider;
use OCP\Authentication\IAlternativeLogin;
+use OCP\Calendar\ICalendarProvider;
use OCP\Capabilities\ICapability;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
@@ -95,6 +96,9 @@ class RegistrationContext {
/** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */
private $twoFactorProviders = [];
+ /** @var ServiceRegistration<ICalendarProvider>[] */
+ private $calendarProviders = [];
+
/** @var LoggerInterface */
private $logger;
@@ -225,6 +229,13 @@ class RegistrationContext {
$twoFactorProviderClass
);
}
+
+ public function registerCalendarProvider(string $class): void {
+ $this->context->registerCalendarProvider(
+ $this->appId,
+ $class
+ );
+ }
};
}
@@ -300,6 +311,10 @@ class RegistrationContext {
$this->twoFactorProviders[] = new ServiceRegistration($appId, $class);
}
+ public function registerCalendarProvider(string $appId, string $class): void {
+ $this->calendarProviders[] = new ServiceRegistration($appId, $class);
+ }
+
/**
* @param App[] $apps
*/
@@ -530,4 +545,11 @@ class RegistrationContext {
public function getTwoFactorProviders(): array {
return $this->twoFactorProviders;
}
+
+ /**
+ * @return ServiceRegistration<ICalendarProvider>[]
+ */
+ public function getCalendarProviders(): array {
+ return $this->calendarProviders;
+ }
}
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php
index a60c8b85b08..c10d7f17bc2 100644
--- a/lib/private/Authentication/Token/DefaultTokenProvider.php
+++ b/lib/private/Authentication/Token/DefaultTokenProvider.php
@@ -71,21 +71,12 @@ class DefaultTokenProvider implements IProvider {
}
/**
- * Create and persist a new token
- *
- * @param string $token
- * @param string $uid
- * @param string $loginName
- * @param string|null $password
- * @param string $name
- * @param int $type token type
- * @param int $remember whether the session token should be used for remember-me
- * @return IToken
+ * {@inheritDoc}
*/
public function generateToken(string $token,
string $uid,
string $loginName,
- $password,
+ ?string $password,
string $name,
int $type = IToken::TEMPORARY_TOKEN,
int $remember = IToken::DO_NOT_REMEMBER): IToken {
diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php
index b37fc2c8cf4..e604ac715c2 100644
--- a/lib/private/Authentication/Token/IProvider.php
+++ b/lib/private/Authentication/Token/IProvider.php
@@ -53,7 +53,7 @@ interface IProvider {
public function generateToken(string $token,
string $uid,
string $loginName,
- $password,
+ ?string $password,
string $name,
int $type = IToken::TEMPORARY_TOKEN,
int $remember = IToken::DO_NOT_REMEMBER): IToken;
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index e8149319904..22c62d82fac 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -80,7 +80,7 @@ class PublicKeyTokenProvider implements IProvider {
public function generateToken(string $token,
string $uid,
string $loginName,
- $password,
+ ?string $password,
string $name,
int $type = IToken::TEMPORARY_TOKEN,
int $remember = IToken::DO_NOT_REMEMBER): IToken {
diff --git a/lib/private/Calendar/CalendarQuery.php b/lib/private/Calendar/CalendarQuery.php
new file mode 100644
index 00000000000..6b4e2b3be16
--- /dev/null
+++ b/lib/private/Calendar/CalendarQuery.php
@@ -0,0 +1,124 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2021 Anna Larch <anna.larch@gmx.net>
+ *
+ * @author Anna Larch <anna.larch@gmx.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OC\Calendar;
+
+use OCP\Calendar\ICalendarQuery;
+
+class CalendarQuery implements ICalendarQuery {
+
+ /** @var string */
+ private $principalUri;
+
+ /** @var array */
+ public $searchProperties;
+
+ /** @var string|null */
+ private $searchPattern;
+
+ /** @var array */
+ private $options;
+
+ /** @var int|null */
+ private $offset;
+
+ /** @var int|null */
+ private $limit;
+
+ /** @var array */
+ private $calendarUris;
+
+ public function __construct(string $principalUri) {
+ $this->principalUri = $principalUri;
+ $this->searchProperties = [];
+ $this->options = [
+ 'types' => [],
+ ];
+ }
+
+ public function getPrincipalUri(): string {
+ return $this->principalUri;
+ }
+
+ public function setPrincipalUri(string $principalUri): void {
+ $this->principalUri = $principalUri;
+ }
+
+ public function setSearchPattern(string $pattern): void {
+ $this->searchPattern = $pattern;
+ }
+
+ public function getSearchPattern(): ?string {
+ return $this->searchPattern;
+ }
+
+ public function addSearchProperty(string $value): void {
+ $this->searchProperties[] = $value;
+ }
+
+ public function getSearchProperties(): array {
+ return $this->searchProperties;
+ }
+
+ public function addSearchCalendar(string $calendarUri): void {
+ $this->calendarUris[] = $calendarUri;
+ }
+
+ public function getCalendarUris(): array {
+ return $this->calendarUris;
+ }
+
+ public function getLimit(): ?int {
+ return $this->limit;
+ }
+
+ public function setLimit(int $limit): void {
+ $this->limit = $limit;
+ }
+
+ public function getOffset(): ?int {
+ return $this->offset;
+ }
+
+ public function setOffset(int $offset): void {
+ $this->offset = $offset;
+ }
+
+ public function addType(string $value): void {
+ $this->options['types'][] = $value;
+ }
+
+ public function setTimerangeStart(\DateTimeImmutable $startTime): void {
+ $this->options['timerange']['start'] = $startTime;
+ }
+
+ public function setTimerangeEnd(\DateTimeImmutable $endTime): void {
+ $this->options['timerange']['end'] = $endTime;
+ }
+
+ public function getOptions(): array {
+ return $this->options;
+ }
+}
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php
index ab22c3ba7b8..30ee60e4943 100644
--- a/lib/private/Calendar/Manager.php
+++ b/lib/private/Calendar/Manager.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
*
@@ -23,9 +26,13 @@
*/
namespace OC\Calendar;
+use OC\AppFramework\Bootstrap\Coordinator;
use OCP\Calendar\ICalendar;
+use OCP\Calendar\ICalendarProvider;
+use OCP\Calendar\ICalendarQuery;
+use OCP\Calendar\IManager;
-class Manager implements \OCP\Calendar\IManager {
+class Manager implements IManager {
/**
* @var ICalendar[] holds all registered calendars
@@ -37,6 +44,13 @@ class Manager implements \OCP\Calendar\IManager {
*/
private $calendarLoaders = [];
+ /** @var Coordinator */
+ private $coordinator;
+
+ public function __construct(Coordinator $coordinator) {
+ $this->coordinator = $coordinator;
+ }
+
/**
* This function is used to search and find objects within the user's calendars.
* In case $pattern is empty all events/journals/todos will be returned.
@@ -137,4 +151,38 @@ class Manager implements \OCP\Calendar\IManager {
}
$this->calendarLoaders = [];
}
+
+ public function searchForPrincipal(ICalendarQuery $query): array {
+ $context = $this->coordinator->getRegistrationContext();
+ if ($context === null) {
+ return [];
+ }
+
+ /** @var CalendarQuery $query */
+ $calendars = array_merge(...array_map(static function (ICalendarProvider $p) use ($query) {
+ return $p->getCalendars($query->getPrincipalUri(), $query->getCalendarUris());
+ }, $context->getCalendarProviders()));
+
+ $results = [];
+ /** @var ICalendar $calendar */
+ foreach ($calendars as $calendar) {
+ $r = $calendar->search(
+ $query->getSearchPattern() ?? '',
+ $query->getSearchProperties(),
+ $query->getOptions(),
+ $query->getLimit(),
+ $query->getOffset()
+ );
+
+ foreach ($r as $o) {
+ $o['calendar-key'] = $calendar->getKey();
+ $results[] = $o;
+ }
+ }
+ return $results;
+ }
+
+ public function newQuery(string $principalUri): ICalendarQuery {
+ return new CalendarQuery($principalUri);
+ }
}
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index 19e70aad147..f3af74167d1 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -113,9 +113,8 @@ class Installer {
throw new \Exception('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
}
- $info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true);
-
$l = \OC::$server->getL10N('core');
+ $info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true, $l->getLanguageCode());
if (!is_array($info)) {
throw new \Exception(
@@ -163,8 +162,7 @@ class Installer {
//run appinfo/install.php
self::includeAppScript($basedir . '/appinfo/install.php');
- $appData = OC_App::getAppInfo($appId);
- OC_App::executeRepairSteps($appId, $appData['repair-steps']['install']);
+ OC_App::executeRepairSteps($appId, $info['repair-steps']['install']);
//set the installed version
\OC::$server->getConfig()->setAppValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id'], false));
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index 96958a32a63..85655c4e379 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -222,7 +222,7 @@ class DefaultShareProvider implements IShareProvider {
$cursor->closeCursor();
if ($data === false) {
- throw new ShareNotFound();
+ throw new ShareNotFound('Newly created share could not be found');
}
$mailSendValue = $share->getMailSend();
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index 101523fcfe7..1ce3662000e 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -992,13 +992,14 @@ class OC_App {
}
\OC::$server->getAppManager()->clearAppsCache();
- $appData = self::getAppInfo($appId);
+ $l = \OC::$server->getL10N('core');
+ $appData = self::getAppInfo($appId, false, $l->getLanguageCode());
$ignoreMaxApps = \OC::$server->getConfig()->getSystemValue('app_install_overwrite', []);
$ignoreMax = in_array($appId, $ignoreMaxApps, true);
\OC_App::checkAppDependencies(
\OC::$server->getConfig(),
- \OC::$server->getL10N('core'),
+ $l,
$appData,
$ignoreMax
);
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php
index 848f460dac5..27c4f6b2857 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -190,7 +190,7 @@ class OC_User {
'post_login',
[
'uid' => $uid,
- 'password' => '',
+ 'password' => null,
'isTokenLogin' => false,
]
);
@@ -199,7 +199,7 @@ class OC_User {
$dispatcher->dispatchTyped(new UserLoggedInEvent(
\OC::$server->get(IUserManager::class)->get($uid),
$uid,
- '',
+ null,
false)
);
diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
index 589140d3edd..d396c619923 100644
--- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
+++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
@@ -228,4 +228,13 @@ interface IRegistrationContext {
* @since 22.0.0
*/
public function registerTwoFactorProvider(string $twoFactorProviderClass): void;
+
+ /**
+ * Register a calendar provider
+ *
+ * @param string $class
+ * @psalm-param class-string<IProvider> $class
+ * @since 23.0.0
+ */
+ public function registerCalendarProvider(string $class): void;
}
diff --git a/lib/public/Calendar/ICalendar.php b/lib/public/Calendar/ICalendar.php
index ebaa7c50f84..551870de20e 100644
--- a/lib/public/Calendar/ICalendar.php
+++ b/lib/public/Calendar/ICalendar.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
*
diff --git a/lib/public/Calendar/ICalendarProvider.php b/lib/public/Calendar/ICalendarProvider.php
new file mode 100644
index 00000000000..d135910b08c
--- /dev/null
+++ b/lib/public/Calendar/ICalendarProvider.php
@@ -0,0 +1,45 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2021 Anna Larch <anna.larch@gmx.net>
+ *
+ * @author Anna Larch <anna.larch@gmx.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ *
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OCP\Calendar;
+
+/**
+ * This interface defines a lazy loading mechanism for
+ * calendars for Public Consumption
+ *
+ * @since 23.0.0
+ */
+interface ICalendarProvider {
+
+ /**
+ * @param string $principalUri
+ * @param string[] $calendarUris
+ * @return ICalendar[]
+ * @since 23.0.0
+ */
+ public function getCalendars(string $principalUri, array $calendarUris = []): array;
+}
diff --git a/lib/public/Calendar/ICalendarQuery.php b/lib/public/Calendar/ICalendarQuery.php
new file mode 100644
index 00000000000..142810d3fb9
--- /dev/null
+++ b/lib/public/Calendar/ICalendarQuery.php
@@ -0,0 +1,82 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2021 Anna Larch <anna.larch@gmx.net>
+ *
+ * @author Anna Larch <anna.larch@gmx.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OCP\Calendar;
+
+use DateTimeImmutable;
+
+/**
+ * Build a flexible, extendable query to the CalDAV backend
+ *
+ * @since 23.0.0
+ */
+interface ICalendarQuery {
+
+ /**
+ * Limit the results to the calendar uri(s)
+ *
+ * @since 23.0.0
+ */
+ public function addSearchCalendar(string $calendarUri): void;
+
+ /**
+ * Search the property values
+ *
+ * @since 23.0.0
+ */
+ public function setSearchPattern(string $pattern): void;
+
+ /**
+ * Define the property name(s) to search for
+ *
+ * @since 23.0.0
+ */
+ public function addSearchProperty(string $value): void;
+
+ /**
+ * @since 23.0.0
+ */
+ public function addType(string $value): void;
+
+ /**
+ * @since 23.0.0
+ */
+ public function setTimerangeStart(DateTimeImmutable $startTime): void;
+
+ /**
+ * @since 23.0.0
+ */
+ public function setTimerangeEnd(DateTimeImmutable $endTime): void;
+
+ /**
+ * @since 23.0.0
+ */
+ public function setLimit(int $limit): void;
+
+ /**
+ * @since 23.0.0
+ */
+ public function setOffset(int $offset): void;
+}
diff --git a/lib/public/Calendar/IManager.php b/lib/public/Calendar/IManager.php
index df4c993b2b5..eb4113bba99 100644
--- a/lib/public/Calendar/IManager.php
+++ b/lib/public/Calendar/IManager.php
@@ -1,9 +1,13 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Georg Ehrke <oc.list@georgehrke.com>
+ * @author Anna Larch <anna.larch@gmx.net>
*
* @license GNU AGPL version 3 or any later version
*
@@ -67,6 +71,7 @@ interface IManager {
* @param integer|null $offset - offset for paging of search results
* @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs
* @since 13.0.0
+ * @deprecated 23.0.0 use \OCP\Calendar\IManager::searchForPrincipal
*/
public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null);
@@ -75,6 +80,7 @@ interface IManager {
*
* @return bool true if enabled, false if not
* @since 13.0.0
+ * @deprecated 23.0.0
*/
public function isEnabled();
@@ -84,6 +90,7 @@ interface IManager {
* @param ICalendar $calendar
* @return void
* @since 13.0.0
+ * @deprecated 23.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider
*/
public function registerCalendar(ICalendar $calendar);
@@ -93,6 +100,7 @@ interface IManager {
* @param ICalendar $calendar
* @return void
* @since 13.0.0
+ * @deprecated 23.0.0
*/
public function unregisterCalendar(ICalendar $calendar);
@@ -103,19 +111,40 @@ interface IManager {
* @param \Closure $callable
* @return void
* @since 13.0.0
+ * @deprecated 23.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider
*/
public function register(\Closure $callable);
/**
* @return ICalendar[]
* @since 13.0.0
+ * @deprecated 23.0.0
*/
public function getCalendars();
/**
* removes all registered calendar instances
+ *
* @return void
* @since 13.0.0
+ * @deprecated 23.0.0
*/
public function clear();
+
+ /**
+ * Query a principals calendar(s)
+ *
+ * @param ICalendarQuery $query
+ * @return array[]
+ * @since 23.0.0
+ */
+ public function searchForPrincipal(ICalendarQuery $query): array;
+
+ /**
+ * Build a new query for searchForPrincipal
+ *
+ * @return ICalendarQuery
+ * @since 23.0.0
+ */
+ public function newQuery(string $principalUri) : ICalendarQuery;
}
diff --git a/lib/public/Share/Exceptions/ShareNotFound.php b/lib/public/Share/Exceptions/ShareNotFound.php
index 6e4dd2677ae..66827b4d179 100644
--- a/lib/public/Share/Exceptions/ShareNotFound.php
+++ b/lib/public/Share/Exceptions/ShareNotFound.php
@@ -27,4 +27,18 @@ namespace OCP\Share\Exceptions;
* @since 9.0.0
*/
class ShareNotFound extends GenericShareException {
+
+ /**
+ * @param string $message
+ * @param string $hint
+ * @param int $code
+ * @param \Exception|null $previous
+ * @since 9.0.0
+ */
+ public function __construct($message = '', ...$arguments) {
+ if (empty($message)) {
+ $message = 'Share not found';
+ }
+ parent::__construct($message, ...$arguments);
+ }
}
diff --git a/lib/public/User/Events/UserLoggedInEvent.php b/lib/public/User/Events/UserLoggedInEvent.php
index b9b36544231..b1a46b9570d 100644
--- a/lib/public/User/Events/UserLoggedInEvent.php
+++ b/lib/public/User/Events/UserLoggedInEvent.php
@@ -37,7 +37,7 @@ class UserLoggedInEvent extends Event {
/** @var IUser */
private $user;
- /** @var string */
+ /** @var string|null */
private $password;
/** @var bool */
@@ -49,7 +49,7 @@ class UserLoggedInEvent extends Event {
/**
* @since 18.0.0
*/
- public function __construct(IUser $user, string $loginName, string $password, bool $isTokenLogin) {
+ public function __construct(IUser $user, string $loginName, ?string $password, bool $isTokenLogin) {
parent::__construct();
$this->user = $user;
$this->password = $password;
@@ -74,7 +74,7 @@ class UserLoggedInEvent extends Event {
/**
* @since 18.0.0
*/
- public function getPassword(): string {
+ public function getPassword(): ?string {
return $this->password;
}
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php
index e686e82adf0..70f7dbe2437 100644
--- a/tests/lib/Calendar/ManagerTest.php
+++ b/tests/lib/Calendar/ManagerTest.php
@@ -23,26 +23,35 @@
namespace Test\Calendar;
+use OC\AppFramework\Bootstrap\Coordinator;
use OC\Calendar\Manager;
use OCP\Calendar\ICalendar;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ManagerTest extends TestCase {
+ /** @var Coordinator|MockObject */
+ private $coordinator;
+
/** @var Manager */
private $manager;
protected function setUp(): void {
parent::setUp();
- $this->manager = new Manager();
+ $this->coordinator = $this->createMock(Coordinator::class);
+
+ $this->manager = new Manager(
+ $this->coordinator
+ );
}
/**
* @dataProvider searchProvider
*/
public function testSearch($search1, $search2, $expected) {
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
+ /** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
@@ -50,7 +59,7 @@ class ManagerTest extends TestCase {
->with('', [], [], null, null)
->willReturn($search1);
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
+ /** @var ICalendar | MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
@@ -69,7 +78,7 @@ class ManagerTest extends TestCase {
* @dataProvider searchProvider
*/
public function testSearchOptions($search1, $search2, $expected) {
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
+ /** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
@@ -78,7 +87,7 @@ class ManagerTest extends TestCase {
['timerange' => ['start' => null, 'end' => null]], 5, 20)
->willReturn($search1);
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
+ /** @var ICalendar | MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
@@ -150,11 +159,11 @@ class ManagerTest extends TestCase {
}
public function testRegisterUnregister() {
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
+ /** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('key1');
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
+ /** @var ICalendar | MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('key2');
@@ -174,11 +183,11 @@ class ManagerTest extends TestCase {
}
public function testGetCalendars() {
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
+ /** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('key1');
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
+ /** @var ICalendar | MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('key2');
@@ -203,7 +212,7 @@ class ManagerTest extends TestCase {
}
public function testIfEnabledIfSo() {
- /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar */
+ /** @var ICalendar | MockObject $calendar */
$calendar = $this->createMock(ICalendar::class);
$this->manager->registerCalendar($calendar);