diff --git a/lib/private/SpeechToText/SpeechToTextManager.php b/lib/private/SpeechToText/SpeechToTextManager.php index 520700cf198..7c9409c1e40 100644 --- a/lib/private/SpeechToText/SpeechToTextManager.php +++ b/lib/private/SpeechToText/SpeechToTextManager.php @@ -36,10 +36,12 @@ use OCP\Files\InvalidPathException; use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IServerContainer; +use OCP\IUserSession; use OCP\PreConditionNotMetException; use OCP\SpeechToText\ISpeechToTextManager; use OCP\SpeechToText\ISpeechToTextProvider; use OCP\SpeechToText\ISpeechToTextProviderWithId; +use OCP\SpeechToText\ISpeechToTextProviderWithUserId; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Psr\Log\LoggerInterface; @@ -56,6 +58,7 @@ class SpeechToTextManager implements ISpeechToTextManager { private LoggerInterface $logger, private IJobList $jobList, private IConfig $config, + private IUserSession $userSession, ) { } @@ -123,6 +126,9 @@ class SpeechToTextManager implements ISpeechToTextManager { if ($provider instanceof ISpeechToTextProviderWithId) { return $provider->getId() === $classNameOrId; } + if ($provider instanceof ISpeechToTextProviderWithUserId) { + $provider->setUserId($this->userSession->getUser()?->getUID()); + } return $provider::class === $classNameOrId; })); if ($provider !== false) { diff --git a/lib/public/SpeechToText/ISpeechToTextProviderWithUserId.php b/lib/public/SpeechToText/ISpeechToTextProviderWithUserId.php new file mode 100644 index 00000000000..2a9b667171d --- /dev/null +++ b/lib/public/SpeechToText/ISpeechToTextProviderWithUserId.php @@ -0,0 +1,37 @@ + + * + * @author Marcel Klehr + * + * @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 . + */ + + +namespace OCP\SpeechToText; + +/** + * @since 29.0.0 + */ +interface ISpeechToTextProviderWithUserId extends ISpeechToTextProvider { + /** + * @since 29.0.0 + */ + public function setUserId(?string $userId): void; +}