mirror of https://github.com/nextcloud/server
Introduce ISpeechToTextProviderWithUserId
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
This commit is contained in:
parent
eaa6d96cf7
commit
13588c7566
|
@ -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) {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2024 Marcel Klehr <mklehr@gmx.net>
|
||||
*
|
||||
* @author Marcel Klehr <mklehr@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\SpeechToText;
|
||||
|
||||
/**
|
||||
* @since 29.0.0
|
||||
*/
|
||||
interface ISpeechToTextProviderWithUserId extends ISpeechToTextProvider {
|
||||
/**
|
||||
* @since 29.0.0
|
||||
*/
|
||||
public function setUserId(?string $userId): void;
|
||||
}
|
Loading…
Reference in New Issue