aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/l10n/is.js2
-rw-r--r--apps/federatedfilesharing/l10n/is.json2
-rw-r--r--apps/federation/lib/AppInfo/Application.php84
-rw-r--r--apps/federation/lib/BackgroundJob/GetSharedSecret.php92
-rw-r--r--apps/federation/lib/BackgroundJob/RequestSharedSecret.php89
-rw-r--r--apps/federation/lib/Command/SyncFederationAddressBooks.php2
-rw-r--r--apps/federation/lib/Controller/OCSAuthAPIController.php20
-rw-r--r--apps/federation/lib/Controller/SettingsController.php1
-rw-r--r--apps/federation/lib/DAV/FedAuth.php2
-rw-r--r--apps/federation/lib/DbHandler.php38
-rw-r--r--apps/federation/lib/Middleware/AddServerMiddleware.php9
-rw-r--r--apps/federation/lib/SyncJob.php21
-rw-r--r--apps/federation/lib/TrustedServers.php12
-rw-r--r--apps/federation/tests/BackgroundJob/GetSharedSecretTest.php90
-rw-r--r--apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php93
-rw-r--r--apps/federation/tests/Controller/OCSAuthAPIControllerTest.php52
-rw-r--r--apps/federation/tests/TrustedServersTest.php18
-rw-r--r--apps/files/l10n/ja.js2
-rw-r--r--apps/files/l10n/ja.json2
-rw-r--r--apps/files_external/l10n/ja.js2
-rw-r--r--apps/files_external/l10n/ja.json2
-rw-r--r--apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php5
-rw-r--r--apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php5
-rw-r--r--apps/oauth2/l10n/ca.js14
-rw-r--r--apps/oauth2/l10n/ca.json12
-rw-r--r--apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php7
-rw-r--r--apps/systemtags/l10n/lv.js9
-rw-r--r--apps/systemtags/l10n/lv.json9
-rw-r--r--apps/theming/l10n/ca.js31
-rw-r--r--apps/theming/l10n/ca.json29
-rw-r--r--apps/theming/l10n/ja.js1
-rw-r--r--apps/theming/l10n/ja.json1
-rw-r--r--apps/theming/l10n/lv.js31
-rw-r--r--apps/theming/l10n/lv.json29
-rw-r--r--apps/updatenotification/css/admin.css3
-rw-r--r--apps/updatenotification/l10n/is.js1
-rw-r--r--apps/updatenotification/l10n/is.json1
-rw-r--r--apps/updatenotification/lib/Controller/AdminController.php12
-rw-r--r--apps/updatenotification/templates/admin.php49
-rw-r--r--apps/updatenotification/tests/Controller/AdminControllerTest.php16
-rw-r--r--apps/workflowengine/l10n/lv.js2
-rw-r--r--apps/workflowengine/l10n/lv.json2
42 files changed, 656 insertions, 248 deletions
diff --git a/apps/federatedfilesharing/l10n/is.js b/apps/federatedfilesharing/l10n/is.js
index 1029a8097b0..d384d56dba6 100644
--- a/apps/federatedfilesharing/l10n/is.js
+++ b/apps/federatedfilesharing/l10n/is.js
@@ -16,11 +16,13 @@ OC.L10N.register(
"Server to server sharing is not enabled on this server" : "Deiling frá þjóni til þjóns er ekki virk á þessum þjóni",
"Couldn't establish a federated share." : "Gat ekki bætt við skýjasambandssameign.",
"Couldn't establish a federated share, maybe the password was wrong." : "Gat ekki bætt við skýjasambandssameign, hugsanlega var lykilorðið ekki rétt.",
+ "Federated Share request sent, you will receive an invitation. Check your notifications." : "Sendi beiðni um skýjasambandssameign, þú munt fá boðskort. Athugaðu skilaboð til þín.",
"The mountpoint name contains invalid characters." : "Heiti tengipunktsins inniheldur ógilda stafi.",
"Not allowed to create a federated share with the owner." : "Ekki er heimilt að búa til skýjasambandssameign með eigandanum.",
"Invalid or untrusted SSL certificate" : "Ógilt eða vantreyst SSL-skilríki",
"Could not authenticate to remote share, password might be wrong" : "Gat ekki auðkennt á fjartengdri sameign, lykilorð gæti verið rangt",
"Storage not valid" : "Geymslan er ekki gild",
+ "Federated share added" : "Bætti við skýjasambandssameign",
"Couldn't add remote share" : "Gat ekki bætt við fjartengdri sameign",
"Sharing %s failed, because this item is already shared with %s" : "Deiling %s mistókst, því þessu atriði er þegar deilt með %s",
"Not allowed to create a federated share with the same user" : "Ekki er heimilt að búa til skýjasambandssameign með sama notanda",
diff --git a/apps/federatedfilesharing/l10n/is.json b/apps/federatedfilesharing/l10n/is.json
index bc372945150..6d0a065c83d 100644
--- a/apps/federatedfilesharing/l10n/is.json
+++ b/apps/federatedfilesharing/l10n/is.json
@@ -14,11 +14,13 @@
"Server to server sharing is not enabled on this server" : "Deiling frá þjóni til þjóns er ekki virk á þessum þjóni",
"Couldn't establish a federated share." : "Gat ekki bætt við skýjasambandssameign.",
"Couldn't establish a federated share, maybe the password was wrong." : "Gat ekki bætt við skýjasambandssameign, hugsanlega var lykilorðið ekki rétt.",
+ "Federated Share request sent, you will receive an invitation. Check your notifications." : "Sendi beiðni um skýjasambandssameign, þú munt fá boðskort. Athugaðu skilaboð til þín.",
"The mountpoint name contains invalid characters." : "Heiti tengipunktsins inniheldur ógilda stafi.",
"Not allowed to create a federated share with the owner." : "Ekki er heimilt að búa til skýjasambandssameign með eigandanum.",
"Invalid or untrusted SSL certificate" : "Ógilt eða vantreyst SSL-skilríki",
"Could not authenticate to remote share, password might be wrong" : "Gat ekki auðkennt á fjartengdri sameign, lykilorð gæti verið rangt",
"Storage not valid" : "Geymslan er ekki gild",
+ "Federated share added" : "Bætti við skýjasambandssameign",
"Couldn't add remote share" : "Gat ekki bætt við fjartengdri sameign",
"Sharing %s failed, because this item is already shared with %s" : "Deiling %s mistókst, því þessu atriði er þegar deilt með %s",
"Not allowed to create a federated share with the same user" : "Ekki er heimilt að búa til skýjasambandssameign með sama notanda",
diff --git a/apps/federation/lib/AppInfo/Application.php b/apps/federation/lib/AppInfo/Application.php
index 55647622915..38bbe293a56 100644
--- a/apps/federation/lib/AppInfo/Application.php
+++ b/apps/federation/lib/AppInfo/Application.php
@@ -24,75 +24,29 @@
namespace OCA\Federation\AppInfo;
-use OCA\Federation\Controller\SettingsController;
use OCA\Federation\DAV\FedAuth;
-use OCA\Federation\DbHandler;
use OCA\Federation\Hooks;
use OCA\Federation\Middleware\AddServerMiddleware;
-use OCA\Federation\SyncFederationAddressBooks;
-use OCA\Federation\TrustedServers;
-use OCP\AppFramework\IAppContainer;
+use OCP\AppFramework\App;
use OCP\SabrePluginEvent;
use OCP\Util;
use Sabre\DAV\Auth\Plugin;
+use Sabre\DAV\Server;
-class Application extends \OCP\AppFramework\App {
+class Application extends App {
/**
* @param array $urlParams
*/
- public function __construct($urlParams = array()) {
+ public function __construct($urlParams = []) {
parent::__construct('federation', $urlParams);
- $this->registerService();
$this->registerMiddleware();
}
- private function registerService() {
- $container = $this->getContainer();
-
- $container->registerService('addServerMiddleware', function(IAppContainer $c) {
- return new AddServerMiddleware(
- $c->getAppName(),
- \OC::$server->getL10N($c->getAppName()),
- \OC::$server->getLogger()
- );
- });
-
- $container->registerService('DbHandler', function(IAppContainer $c) {
- return new DbHandler(
- \OC::$server->getDatabaseConnection(),
- \OC::$server->getL10N($c->getAppName())
- );
- });
-
- $container->registerService('TrustedServers', function(IAppContainer $c) {
- $server = $c->getServer();
- return new TrustedServers(
- $c->query('DbHandler'),
- $server->getHTTPClientService(),
- $server->getLogger(),
- $server->getJobList(),
- $server->getSecureRandom(),
- $server->getConfig(),
- $server->getEventDispatcher()
- );
- });
-
- $container->registerService('SettingsController', function (IAppContainer $c) {
- $server = $c->getServer();
- return new SettingsController(
- $c->getAppName(),
- $server->getRequest(),
- $server->getL10N($c->getAppName()),
- $c->query('TrustedServers')
- );
- });
-
- }
-
private function registerMiddleware() {
$container = $this->getContainer();
- $container->registerMiddleware('addServerMiddleware');
+ $container->registerAlias('AddServerMiddleware', AddServerMiddleware::class);
+ $container->registerMiddleWare('AddServerMiddleware');
}
/**
@@ -102,7 +56,7 @@ class Application extends \OCP\AppFramework\App {
public function registerHooks() {
$container = $this->getContainer();
- $hooksManager = new Hooks($container->query('TrustedServers'));
+ $hooksManager = $container->query(Hooks::class);
Util::connectHook(
'OCP\Share',
@@ -111,28 +65,18 @@ class Application extends \OCP\AppFramework\App {
'addServerHook'
);
- $dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
+ $dispatcher = $container->getServer()->getEventDispatcher();
$dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use($container) {
if ($event instanceof SabrePluginEvent) {
- $authPlugin = $event->getServer()->getPlugin('auth');
- if ($authPlugin instanceof Plugin) {
- $h = new DbHandler($container->getServer()->getDatabaseConnection(),
- $container->getServer()->getL10N('federation')
- );
- $authPlugin->addBackend(new FedAuth($h));
+ $server = $event->getServer();
+ if ($server instanceof Server) {
+ $authPlugin = $server->getPlugin('auth');
+ if ($authPlugin instanceof Plugin) {
+ $authPlugin->addBackend($container->query(FedAuth::class));
+ }
}
}
});
}
- /**
- * @return SyncFederationAddressBooks
- */
- public function getSyncService() {
- $syncService = \OC::$server->query('CardDAVSyncService');
- $dbHandler = $this->getContainer()->query('DbHandler');
- $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class);
- return new SyncFederationAddressBooks($dbHandler, $syncService, $discoveryService);
- }
-
}
diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php
index 8a8d475da61..bf9f58999db 100644
--- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php
+++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php
@@ -32,8 +32,10 @@ use OC\BackgroundJob\Job;
use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\ILogger;
use OCP\IURLGenerator;
@@ -46,7 +48,7 @@ use OCP\OCS\IDiscoveryService;
*
* @package OCA\Federation\Backgroundjob
*/
-class GetSharedSecret extends Job{
+class GetSharedSecret extends Job {
/** @var IClient */
private $httpClient;
@@ -69,6 +71,9 @@ class GetSharedSecret extends Job{
/** @var ILogger */
private $logger;
+ /** @var ITimeFactory */
+ private $timeFactory;
+
/** @var bool */
protected $retainJob = false;
@@ -76,45 +81,39 @@ class GetSharedSecret extends Job{
private $defaultEndPoint = '/ocs/v2.php/apps/federation/api/v1/shared-secret';
+ /** @var int 30 day = 2592000sec */
+ private $maxLifespan = 2592000;
+
/**
* RequestSharedSecret constructor.
*
- * @param IClient $httpClient
+ * @param IClientService $httpClientService
* @param IURLGenerator $urlGenerator
* @param IJobList $jobList
* @param TrustedServers $trustedServers
* @param ILogger $logger
* @param DbHandler $dbHandler
* @param IDiscoveryService $ocsDiscoveryService
+ * @param ITimeFactory $timeFactory
*/
public function __construct(
- IClient $httpClient = null,
- IURLGenerator $urlGenerator = null,
- IJobList $jobList = null,
- TrustedServers $trustedServers = null,
- ILogger $logger = null,
- DbHandler $dbHandler = null,
- IDiscoveryService $ocsDiscoveryService = null
+ IClientService $httpClientService,
+ IURLGenerator $urlGenerator,
+ IJobList $jobList,
+ TrustedServers $trustedServers,
+ ILogger $logger,
+ DbHandler $dbHandler,
+ IDiscoveryService $ocsDiscoveryService,
+ ITimeFactory $timeFactory
) {
- $this->logger = $logger ? $logger : \OC::$server->getLogger();
- $this->httpClient = $httpClient ? $httpClient : \OC::$server->getHTTPClientService()->newClient();
- $this->jobList = $jobList ? $jobList : \OC::$server->getJobList();
- $this->urlGenerator = $urlGenerator ? $urlGenerator : \OC::$server->getURLGenerator();
- $this->dbHandler = $dbHandler ? $dbHandler : new DbHandler(\OC::$server->getDatabaseConnection(), \OC::$server->getL10N('federation'));
- $this->ocsDiscoveryService = $ocsDiscoveryService ? $ocsDiscoveryService : \OC::$server->query(\OCP\OCS\IDiscoveryService::class);
- if ($trustedServers) {
- $this->trustedServers = $trustedServers;
- } else {
- $this->trustedServers = new TrustedServers(
- $this->dbHandler,
- \OC::$server->getHTTPClientService(),
- $this->logger,
- $this->jobList,
- \OC::$server->getSecureRandom(),
- \OC::$server->getConfig(),
- \OC::$server->getEventDispatcher()
- );
- }
+ $this->logger = $logger;
+ $this->httpClient = $httpClientService->newClient();
+ $this->jobList = $jobList;
+ $this->urlGenerator = $urlGenerator;
+ $this->dbHandler = $dbHandler;
+ $this->ocsDiscoveryService = $ocsDiscoveryService;
+ $this->trustedServers = $trustedServers;
+ $this->timeFactory = $timeFactory;
}
/**
@@ -130,8 +129,10 @@ class GetSharedSecret extends Job{
$this->parentExecute($jobList, $logger);
}
- if (!$this->retainJob) {
- $jobList->remove($this, $this->argument);
+ $jobList->remove($this, $this->argument);
+
+ if ($this->retainJob) {
+ $this->reAddJob($this->argument);
}
}
@@ -147,14 +148,24 @@ class GetSharedSecret extends Job{
protected function run($argument) {
$target = $argument['url'];
+ $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime();
+ $currentTime = $this->timeFactory->getTime();
$source = $this->urlGenerator->getAbsoluteURL('/');
$source = rtrim($source, '/');
$token = $argument['token'];
+ // kill job after 30 days of trying
+ $deadline = $currentTime - $this->maxLifespan;
+ if ($created < $deadline) {
+ $this->retainJob = false;
+ $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE);
+ return;
+ }
+
$endPoints = $this->ocsDiscoveryService->discover($target, 'FEDERATED_SHARING');
$endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint;
- // make sure that we have a well formated url
+ // make sure that we have a well formatted url
$url = rtrim($target, '/') . '/' . trim($endPoint, '/') . $this->format;
$result = null;
@@ -215,4 +226,23 @@ class GetSharedSecret extends Job{
}
}
+
+ /**
+ * re-add background job
+ *
+ * @param array $argument
+ */
+ protected function reAddJob(array $argument) {
+ $url = $argument['url'];
+ $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime();
+ $token = $argument['token'];
+ $this->jobList->add(
+ GetSharedSecret::class,
+ [
+ 'url' => $url,
+ 'token' => $token,
+ 'created' => $created
+ ]
+ );
+ }
}
diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
index 77d0234ef74..7effb838d8b 100644
--- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
+++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
@@ -33,8 +33,10 @@ use OC\BackgroundJob\Job;
use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\OCS\IDiscoveryService;
@@ -69,6 +71,9 @@ class RequestSharedSecret extends Job {
/** @var ILogger */
private $logger;
+ /** @var ITimeFactory */
+ private $timeFactory;
+
/** @var bool */
protected $retainJob = false;
@@ -76,43 +81,39 @@ class RequestSharedSecret extends Job {
private $defaultEndPoint = '/ocs/v2.php/apps/federation/api/v1/request-shared-secret';
+ /** @var int 30 day = 2592000sec */
+ private $maxLifespan = 2592000;
+
/**
* RequestSharedSecret constructor.
*
- * @param IClient $httpClient
+ * @param IClientService $httpClientService
* @param IURLGenerator $urlGenerator
* @param IJobList $jobList
* @param TrustedServers $trustedServers
* @param DbHandler $dbHandler
* @param IDiscoveryService $ocsDiscoveryService
+ * @param ILogger $logger
+ * @param ITimeFactory $timeFactory
*/
public function __construct(
- IClient $httpClient = null,
- IURLGenerator $urlGenerator = null,
- IJobList $jobList = null,
- TrustedServers $trustedServers = null,
- DbHandler $dbHandler = null,
- IDiscoveryService $ocsDiscoveryService = null
+ IClientService $httpClientService,
+ IURLGenerator $urlGenerator,
+ IJobList $jobList,
+ TrustedServers $trustedServers,
+ DbHandler $dbHandler,
+ IDiscoveryService $ocsDiscoveryService,
+ ILogger $logger,
+ ITimeFactory $timeFactory
) {
- $this->httpClient = $httpClient ? $httpClient : \OC::$server->getHTTPClientService()->newClient();
- $this->jobList = $jobList ? $jobList : \OC::$server->getJobList();
- $this->urlGenerator = $urlGenerator ? $urlGenerator : \OC::$server->getURLGenerator();
- $this->dbHandler = $dbHandler ? $dbHandler : new DbHandler(\OC::$server->getDatabaseConnection(), \OC::$server->getL10N('federation'));
- $this->logger = \OC::$server->getLogger();
- $this->ocsDiscoveryService = $ocsDiscoveryService ? $ocsDiscoveryService : \OC::$server->query(\OCP\OCS\IDiscoveryService::class);
- if ($trustedServers) {
- $this->trustedServers = $trustedServers;
- } else {
- $this->trustedServers = new TrustedServers(
- $this->dbHandler,
- \OC::$server->getHTTPClientService(),
- $this->logger,
- $this->jobList,
- \OC::$server->getSecureRandom(),
- \OC::$server->getConfig(),
- \OC::$server->getEventDispatcher()
- );
- }
+ $this->httpClient = $httpClientService->newClient();
+ $this->jobList = $jobList;
+ $this->urlGenerator = $urlGenerator;
+ $this->dbHandler = $dbHandler;
+ $this->logger = $logger;
+ $this->ocsDiscoveryService = $ocsDiscoveryService;
+ $this->trustedServers = $trustedServers;
+ $this->timeFactory = $timeFactory;
}
@@ -129,8 +130,10 @@ class RequestSharedSecret extends Job {
$this->parentExecute($jobList, $logger);
}
- if (!$this->retainJob) {
- $jobList->remove($this, $this->argument);
+ $jobList->remove($this, $this->argument);
+
+ if ($this->retainJob) {
+ $this->reAddJob($this->argument);
}
}
@@ -147,10 +150,20 @@ class RequestSharedSecret extends Job {
protected function run($argument) {
$target = $argument['url'];
+ $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime();
+ $currentTime = $this->timeFactory->getTime();
$source = $this->urlGenerator->getAbsoluteURL('/');
$source = rtrim($source, '/');
$token = $argument['token'];
+ // kill job after 30 days of trying
+ $deadline = $currentTime - $this->maxLifespan;
+ if ($created < $deadline) {
+ $this->retainJob = false;
+ $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
+ return;
+ }
+
$endPoints = $this->ocsDiscoveryService->discover($target, 'FEDERATED_SHARING');
$endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint;
@@ -198,4 +211,24 @@ class RequestSharedSecret extends Job {
}
}
+
+ /**
+ * re-add background job
+ *
+ * @param array $argument
+ */
+ protected function reAddJob(array $argument) {
+ $url = $argument['url'];
+ $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime();
+ $token = $argument['token'];
+
+ $this->jobList->add(
+ RequestSharedSecret::class,
+ [
+ 'url' => $url,
+ 'token' => $token,
+ 'created' => $created
+ ]
+ );
+ }
}
diff --git a/apps/federation/lib/Command/SyncFederationAddressBooks.php b/apps/federation/lib/Command/SyncFederationAddressBooks.php
index fb3a2749ff8..db332d3d7ad 100644
--- a/apps/federation/lib/Command/SyncFederationAddressBooks.php
+++ b/apps/federation/lib/Command/SyncFederationAddressBooks.php
@@ -36,7 +36,7 @@ class SyncFederationAddressBooks extends Command {
/**
* @param \OCA\Federation\SyncFederationAddressBooks $syncService
*/
- function __construct(\OCA\Federation\SyncFederationAddressBooks $syncService) {
+ public function __construct(\OCA\Federation\SyncFederationAddressBooks $syncService) {
parent::__construct();
$this->syncService = $syncService;
diff --git a/apps/federation/lib/Controller/OCSAuthAPIController.php b/apps/federation/lib/Controller/OCSAuthAPIController.php
index 594299a2d02..b0594877b23 100644
--- a/apps/federation/lib/Controller/OCSAuthAPIController.php
+++ b/apps/federation/lib/Controller/OCSAuthAPIController.php
@@ -32,6 +32,7 @@ use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCSController;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\ILogger;
use OCP\IRequest;
@@ -61,6 +62,9 @@ class OCSAuthAPIController extends OCSController{
/** @var ILogger */
private $logger;
+ /** @var ITimeFactory */
+ private $timeFactory;
+
/**
* OCSAuthAPI constructor.
*
@@ -71,6 +75,7 @@ class OCSAuthAPIController extends OCSController{
* @param TrustedServers $trustedServers
* @param DbHandler $dbHandler
* @param ILogger $logger
+ * @param ITimeFactory $timeFactory
*/
public function __construct(
$appName,
@@ -79,7 +84,8 @@ class OCSAuthAPIController extends OCSController{
IJobList $jobList,
TrustedServers $trustedServers,
DbHandler $dbHandler,
- ILogger $logger
+ ILogger $logger,
+ ITimeFactory $timeFactory
) {
parent::__construct($appName, $request);
@@ -88,6 +94,7 @@ class OCSAuthAPIController extends OCSController{
$this->trustedServers = $trustedServers;
$this->dbHandler = $dbHandler;
$this->logger = $logger;
+ $this->timeFactory = $timeFactory;
}
/**
@@ -149,20 +156,12 @@ class OCSAuthAPIController extends OCSController{
throw new OCSForbiddenException();
}
- // we ask for the shared secret so we no longer have to ask the other server
- // to request the shared secret
- $this->jobList->remove('OCA\Federation\BackgroundJob\RequestSharedSecret',
- [
- 'url' => $url,
- 'token' => $localToken
- ]
- );
-
$this->jobList->add(
'OCA\Federation\BackgroundJob\GetSharedSecret',
[
'url' => $url,
'token' => $token,
+ 'created' => $this->timeFactory->getTime()
]
);
@@ -210,5 +209,4 @@ class OCSAuthAPIController extends OCSController{
$storedToken = $this->dbHandler->getToken($url);
return hash_equals($storedToken, $token);
}
-
}
diff --git a/apps/federation/lib/Controller/SettingsController.php b/apps/federation/lib/Controller/SettingsController.php
index afbaa4abeee..68267dcb73c 100644
--- a/apps/federation/lib/Controller/SettingsController.php
+++ b/apps/federation/lib/Controller/SettingsController.php
@@ -26,7 +26,6 @@ namespace OCA\Federation\Controller;
use OC\HintException;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IL10N;
use OCP\IRequest;
diff --git a/apps/federation/lib/DAV/FedAuth.php b/apps/federation/lib/DAV/FedAuth.php
index ae78ffeded9..511888f7683 100644
--- a/apps/federation/lib/DAV/FedAuth.php
+++ b/apps/federation/lib/DAV/FedAuth.php
@@ -63,6 +63,6 @@ class FedAuth extends AbstractBasic {
/**
* @inheritdoc
*/
- function challenge(RequestInterface $request, ResponseInterface $response) {
+ public function challenge(RequestInterface $request, ResponseInterface $response) {
}
}
diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php
index c938cfb1583..04968daf0fd 100644
--- a/apps/federation/lib/DbHandler.php
+++ b/apps/federation/lib/DbHandler.php
@@ -88,11 +88,11 @@ class DbHandler {
if ($result) {
return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
- } else {
- $message = 'Internal failure, Could not add trusted server: ' . $url;
- $message_t = $this->IL10N->t('Could not add server');
- throw new HintException($message, $message_t);
}
+
+ $message = 'Internal failure, Could not add trusted server: ' . $url;
+ $message_t = $this->IL10N->t('Could not add server');
+ throw new HintException($message, $message_t);
}
/**
@@ -137,8 +137,11 @@ class DbHandler {
*/
public function getAllServer() {
$query = $this->connection->getQueryBuilder();
- $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token'])->from($this->dbTable);
- $result = $query->execute()->fetchAll();
+ $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token'])
+ ->from($this->dbTable);
+ $statement = $query->execute();
+ $result = $statement->fetchAll();
+ $statement->closeCursor();
return $result;
}
@@ -151,10 +154,13 @@ class DbHandler {
public function serverExists($url) {
$hash = $this->hash($url);
$query = $this->connection->getQueryBuilder();
- $query->select('url')->from($this->dbTable)
+ $query->select('url')
+ ->from($this->dbTable)
->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
->setParameter('url_hash', $hash);
- $result = $query->execute()->fetchAll();
+ $statement = $query->execute();
+ $result = $statement->fetchAll();
+ $statement->closeCursor();
return !empty($result);
}
@@ -190,7 +196,9 @@ class DbHandler {
->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
->setParameter('url_hash', $hash);
- $result = $query->execute()->fetch();
+ $statement = $query->execute();
+ $result = $statement->fetch();
+ $statement->closeCursor();
if (!isset($result['token'])) {
throw new \Exception('No token found for: ' . $url);
@@ -229,7 +237,9 @@ class DbHandler {
->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
->setParameter('url_hash', $hash);
- $result = $query->execute()->fetch();
+ $statement = $query->execute();
+ $result = $statement->fetch();
+ $statement->closeCursor();
return $result['shared_secret'];
}
@@ -265,7 +275,9 @@ class DbHandler {
->where($query->expr()->eq('url_hash', $query->createParameter('url_hash')))
->setParameter('url_hash', $hash);
- $result = $query->execute()->fetch();
+ $statement = $query->execute();
+ $result = $statement->fetch();
+ $statement->closeCursor();
return (int)$result['status'];
}
@@ -314,7 +326,9 @@ class DbHandler {
$query->select('url')->from($this->dbTable)
->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password)));
- $result = $query->execute()->fetch();
+ $statement = $query->execute();
+ $result = $statement->fetch();
+ $statement->closeCursor();
return !empty($result);
}
diff --git a/apps/federation/lib/Middleware/AddServerMiddleware.php b/apps/federation/lib/Middleware/AddServerMiddleware.php
index 71e517f6b87..082596216c8 100644
--- a/apps/federation/lib/Middleware/AddServerMiddleware.php
+++ b/apps/federation/lib/Middleware/AddServerMiddleware.php
@@ -26,6 +26,7 @@ namespace OCA\Federation\Middleware;
use OC\HintException;
use OCA\Federation\Controller\SettingsController;
+use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Middleware;
@@ -43,6 +44,11 @@ class AddServerMiddleware extends Middleware {
/** @var ILogger */
protected $logger;
+ /**
+ * @param string $appName
+ * @param IL10N $l
+ * @param ILogger $logger
+ */
public function __construct($appName, IL10N $l, ILogger $logger) {
$this->appName = $appName;
$this->l = $l;
@@ -52,10 +58,11 @@ class AddServerMiddleware extends Middleware {
/**
* Log error message and return a response which can be displayed to the user
*
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
* @param \Exception $exception
* @return JSONResponse
+ * @throws \Exception
*/
public function afterException($controller, $methodName, \Exception $exception) {
if (($controller instanceof SettingsController) === false) {
diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php
index 060504efb7b..2e5d1578ba2 100644
--- a/apps/federation/lib/SyncJob.php
+++ b/apps/federation/lib/SyncJob.php
@@ -24,20 +24,31 @@ namespace OCA\Federation;
use OC\BackgroundJob\TimedJob;
use OCA\Federation\AppInfo\Application;
+use OCP\ILogger;
class SyncJob extends TimedJob {
- public function __construct() {
+ /** @var SyncFederationAddressBooks */
+ protected $syncService;
+
+ /** @var ILogger */
+ protected $logger;
+
+ /**
+ * @param SyncFederationAddressBooks $syncService
+ * @param ILogger $logger
+ */
+ public function __construct(SyncFederationAddressBooks $syncService, ILogger $logger) {
// Run once a day
$this->setInterval(24 * 60 * 60);
+ $this->syncService = $syncService;
+ $this->logger = $logger;
}
protected function run($argument) {
- $app = new Application();
- $ss = $app->getSyncService();
- $ss->syncThemAll(function($url, $ex) {
+ $this->syncService->syncThemAll(function($url, $ex) {
if ($ex instanceof \Exception) {
- \OC::$server->getLogger()->error("Error while syncing $url : " . $ex->getMessage(), ['app' => 'fed-sync']);
+ $this->logger->error("Error while syncing $url : " . $ex->getMessage(), ['app' => 'fed-sync']);
}
});
}
diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php
index 9bf1452eab3..067cf671a96 100644
--- a/apps/federation/lib/TrustedServers.php
+++ b/apps/federation/lib/TrustedServers.php
@@ -28,6 +28,7 @@ namespace OCA\Federation;
use OC\HintException;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
@@ -68,6 +69,9 @@ class TrustedServers {
/** @var EventDispatcherInterface */
private $dispatcher;
+ /** @var ITimeFactory */
+ private $timeFactory;
+
/**
* @param DbHandler $dbHandler
* @param IClientService $httpClientService
@@ -76,6 +80,7 @@ class TrustedServers {
* @param ISecureRandom $secureRandom
* @param IConfig $config
* @param EventDispatcherInterface $dispatcher
+ * @param ITimeFactory $timeFactory
*/
public function __construct(
DbHandler $dbHandler,
@@ -84,7 +89,8 @@ class TrustedServers {
IJobList $jobList,
ISecureRandom $secureRandom,
IConfig $config,
- EventDispatcherInterface $dispatcher
+ EventDispatcherInterface $dispatcher,
+ ITimeFactory $timeFactory
) {
$this->dbHandler = $dbHandler;
$this->httpClientService = $httpClientService;
@@ -93,6 +99,7 @@ class TrustedServers {
$this->secureRandom = $secureRandom;
$this->config = $config;
$this->dispatcher = $dispatcher;
+ $this->timeFactory = $timeFactory;
}
/**
@@ -111,7 +118,8 @@ class TrustedServers {
'OCA\Federation\BackgroundJob\RequestSharedSecret',
[
'url' => $url,
- 'token' => $token
+ 'token' => $token,
+ 'created' => $this->timeFactory->getTime()
]
);
}
diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
index 6364ddaedff..8759392caea 100644
--- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
@@ -31,8 +31,10 @@ use OCA\Files_Sharing\Tests\TestCase;
use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\ILogger;
use OCP\IURLGenerator;
@@ -47,36 +49,43 @@ use OCP\OCS\IDiscoveryService;
*/
class GetSharedSecretTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject | IClient */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IClient */
private $httpClient;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IJobList */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IClientService */
+ private $httpClientService;
+
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IJobList */
private $jobList;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IURLGenerator */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IURLGenerator */
private $urlGenerator;
- /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|TrustedServers */
private $trustedServers;
- /** @var \PHPUnit_Framework_MockObject_MockObject | DbHandler */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|DbHandler */
private $dbHandler;
- /** @var \PHPUnit_Framework_MockObject_MockObject | ILogger */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ILogger */
private $logger;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IResponse */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IResponse */
private $response;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IDiscoveryService */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IDiscoveryService */
private $discoverService;
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ITimeFactory */
+ private $timeFactory;
+
/** @var GetSharedSecret */
private $getSharedSecret;
public function setUp() {
parent::setUp();
+ $this->httpClientService = $this->createMock(IClientService::class);
$this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
$this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
@@ -87,17 +96,20 @@ class GetSharedSecretTest extends TestCase {
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->discoverService = $this->getMockBuilder(IDiscoveryService::class)->getMock();
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
$this->discoverService->expects($this->any())->method('discover')->willReturn([]);
+ $this->httpClientService->expects($this->any())->method('newClient')->willReturn($this->httpClient);
$this->getSharedSecret = new GetSharedSecret(
- $this->httpClient,
+ $this->httpClientService,
$this->urlGenerator,
$this->jobList,
$this->trustedServers,
$this->logger,
$this->dbHandler,
- $this->discoverService
+ $this->discoverService,
+ $this->timeFactory
);
}
@@ -112,16 +124,17 @@ class GetSharedSecretTest extends TestCase {
$getSharedSecret = $this->getMockBuilder('OCA\Federation\BackgroundJob\GetSharedSecret')
->setConstructorArgs(
[
- $this->httpClient,
+ $this->httpClientService,
$this->urlGenerator,
$this->jobList,
$this->trustedServers,
$this->logger,
$this->dbHandler,
- $this->discoverService
+ $this->discoverService,
+ $this->timeFactory
]
)->setMethods(['parentExecute'])->getMock();
- $this->invokePrivate($getSharedSecret, 'argument', [['url' => 'url']]);
+ $this->invokePrivate($getSharedSecret, 'argument', [['url' => 'url', 'token' => 'token']]);
$this->trustedServers->expects($this->once())->method('isTrustedServer')
->with('url')->willReturn($isTrustedServer);
@@ -131,10 +144,23 @@ class GetSharedSecretTest extends TestCase {
$getSharedSecret->expects($this->never())->method('parentExecute');
}
$this->invokePrivate($getSharedSecret, 'retainJob', [$retainBackgroundJob]);
+ $this->jobList->expects($this->once())->method('remove');
+
+ $this->timeFactory->method('getTime')->willReturn(42);
+
if ($retainBackgroundJob) {
- $this->jobList->expects($this->never())->method('remove');
+ $this->jobList->expects($this->once())
+ ->method('add')
+ ->with(
+ GetSharedSecret::class,
+ [
+ 'url' => 'url',
+ 'token' => 'token',
+ 'created' => 42,
+ ]
+ );
} else {
- $this->jobList->expects($this->once())->method('remove');
+ $this->jobList->expects($this->never())->method('add');
}
$getSharedSecret->execute($this->jobList);
@@ -155,13 +181,15 @@ class GetSharedSecretTest extends TestCase {
* @param int $statusCode
*/
public function testRun($statusCode) {
-
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';
$argument = ['url' => $target, 'token' => $token];
+ $this->timeFactory->method('getTime')
+ ->willReturn(42);
+
$this->urlGenerator->expects($this->once())->method('getAbsoluteURL')->with('/')
->willReturn($source);
$this->httpClient->expects($this->once())->method('get')
@@ -208,7 +236,6 @@ class GetSharedSecretTest extends TestCase {
} else {
$this->assertFalse($this->invokePrivate($this->getSharedSecret, 'retainJob'));
}
-
}
public function dataTestRun() {
@@ -219,4 +246,33 @@ class GetSharedSecretTest extends TestCase {
];
}
+ public function testRunExpired() {
+ $target = 'targetURL';
+ $source = 'sourceURL';
+ $token = 'token';
+ $created = 42;
+
+ $argument = [
+ 'url' => $target,
+ 'token' => $token,
+ 'created' => $created,
+ ];
+
+ $this->urlGenerator->expects($this->once())
+ ->method('getAbsoluteURL')
+ ->with('/')
+ ->willReturn($source);
+
+ $this->timeFactory->method('getTime')
+ ->willReturn($created + 2592000 + 1);
+
+ $this->trustedServers->expects($this->once())
+ ->method('setServerStatus')
+ ->with(
+ $target,
+ TrustedServers::STATUS_FAILURE
+ );
+
+ $this->invokePrivate($this->getSharedSecret, 'run', [$argument]);
+ }
}
diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
index 06da29d17fc..276180e5137 100644
--- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
@@ -29,42 +29,55 @@ use OCA\Federation\BackgroundJob\RequestSharedSecret;
use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
+use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\OCS\IDiscoveryService;
use Test\TestCase;
class RequestSharedSecretTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject | IClient */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IClientService */
+ private $httpClientService;
+
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IClient */
private $httpClient;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IJobList */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IJobList */
private $jobList;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IURLGenerator */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IURLGenerator */
private $urlGenerator;
- /** @var \PHPUnit_Framework_MockObject_MockObject | DbHandler */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|DbHandler */
private $dbHandler;
- /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|TrustedServers */
private $trustedServers;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IResponse */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IResponse */
private $response;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IDiscoveryService */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IDiscoveryService */
private $discoveryService;
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ILogger */
+ private $logger;
+
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ITimeFactory */
+ private $timeFactory;
+
/** @var RequestSharedSecret */
private $requestSharedSecret;
public function setUp() {
parent::setUp();
+ $this->httpClientService = $this->createMock(IClientService::class);
$this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
$this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
@@ -74,16 +87,21 @@ class RequestSharedSecretTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->discoveryService = $this->getMockBuilder(IDiscoveryService::class)->getMock();
+ $this->logger = $this->createMock(ILogger::class);
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
$this->discoveryService->expects($this->any())->method('discover')->willReturn([]);
+ $this->httpClientService->expects($this->any())->method('newClient')->willReturn($this->httpClient);
$this->requestSharedSecret = new RequestSharedSecret(
- $this->httpClient,
+ $this->httpClientService,
$this->urlGenerator,
$this->jobList,
$this->trustedServers,
$this->dbHandler,
- $this->discoveryService
+ $this->discoveryService,
+ $this->logger,
+ $this->timeFactory
);
}
@@ -98,15 +116,17 @@ class RequestSharedSecretTest extends TestCase {
$requestSharedSecret = $this->getMockBuilder('OCA\Federation\BackgroundJob\RequestSharedSecret')
->setConstructorArgs(
[
- $this->httpClient,
+ $this->httpClientService,
$this->urlGenerator,
$this->jobList,
$this->trustedServers,
$this->dbHandler,
- $this->discoveryService
+ $this->discoveryService,
+ $this->logger,
+ $this->timeFactory
]
)->setMethods(['parentExecute'])->getMock();
- $this->invokePrivate($requestSharedSecret, 'argument', [['url' => 'url']]);
+ $this->invokePrivate($requestSharedSecret, 'argument', [['url' => 'url', 'token' => 'token']]);
$this->trustedServers->expects($this->once())->method('isTrustedServer')
->with('url')->willReturn($isTrustedServer);
@@ -116,10 +136,23 @@ class RequestSharedSecretTest extends TestCase {
$requestSharedSecret->expects($this->never())->method('parentExecute');
}
$this->invokePrivate($requestSharedSecret, 'retainJob', [$retainBackgroundJob]);
+ $this->jobList->expects($this->once())->method('remove');
+
+ $this->timeFactory->method('getTime')->willReturn(42);
+
if ($retainBackgroundJob) {
- $this->jobList->expects($this->never())->method('remove');
+ $this->jobList->expects($this->once())
+ ->method('add')
+ ->with(
+ RequestSharedSecret::class,
+ [
+ 'url' => 'url',
+ 'token' => 'token',
+ 'created' => 42,
+ ]
+ );
} else {
- $this->jobList->expects($this->once())->method('remove');
+ $this->jobList->expects($this->never())->method('add');
}
$requestSharedSecret->execute($this->jobList);
@@ -147,6 +180,8 @@ class RequestSharedSecretTest extends TestCase {
$argument = ['url' => $target, 'token' => $token];
+ $this->timeFactory->method('getTime')->willReturn(42);
+
$this->urlGenerator->expects($this->once())->method('getAbsoluteURL')->with('/')
->willReturn($source);
$this->httpClient->expects($this->once())->method('post')
@@ -195,4 +230,34 @@ class RequestSharedSecretTest extends TestCase {
[Http::STATUS_CONFLICT],
];
}
+
+ public function testRunExpired() {
+ $target = 'targetURL';
+ $source = 'sourceURL';
+ $token = 'token';
+ $created = 42;
+
+ $argument = [
+ 'url' => $target,
+ 'token' => $token,
+ 'created' => $created,
+ ];
+
+ $this->urlGenerator->expects($this->once())
+ ->method('getAbsoluteURL')
+ ->with('/')
+ ->willReturn($source);
+
+ $this->timeFactory->method('getTime')
+ ->willReturn($created + 2592000 + 1);
+
+ $this->trustedServers->expects($this->once())
+ ->method('setServerStatus')
+ ->with(
+ $target,
+ TrustedServers::STATUS_FAILURE
+ );
+
+ $this->invokePrivate($this->requestSharedSecret, 'run', [$argument]);
+ }
}
diff --git a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
index 2b231b4fca0..ef6c7c80bfc 100644
--- a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
+++ b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
@@ -29,8 +29,8 @@ use OC\BackgroundJob\JobList;
use OCA\Federation\Controller\OCSAuthAPIController;
use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
-use OCP\AppFramework\Http;
use OCP\AppFramework\OCS\OCSForbiddenException;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\ILogger;
use OCP\IRequest;
use OCP\Security\ISecureRandom;
@@ -38,40 +38,45 @@ use Test\TestCase;
class OCSAuthAPIControllerTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject | IRequest */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|IRequest */
private $request;
- /** @var \PHPUnit_Framework_MockObject_MockObject | ISecureRandom */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ISecureRandom */
private $secureRandom;
- /** @var \PHPUnit_Framework_MockObject_MockObject | JobList */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|JobList */
private $jobList;
- /** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|TrustedServers */
private $trustedServers;
- /** @var \PHPUnit_Framework_MockObject_MockObject | DbHandler */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|DbHandler */
private $dbHandler;
- /** @var \PHPUnit_Framework_MockObject_MockObject | ILogger */
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ILogger */
private $logger;
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ITimeFactory */
+ private $timeFactory;
+
+
/** @var OCSAuthAPIController */
private $ocsAuthApi;
+ /** @var int simulated timestamp */
+ private $currentTime = 1234567;
+
public function setUp() {
parent::setUp();
- $this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
- $this->secureRandom = $this->getMockBuilder('OCP\Security\ISecureRandom')->getMock();
- $this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
- ->disableOriginalConstructor()->getMock();
- $this->dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
- ->disableOriginalConstructor()->getMock();
- $this->jobList = $this->getMockBuilder('OC\BackgroundJob\JobList')
- ->disableOriginalConstructor()->getMock();
- $this->logger = $this->getMockBuilder('OCP\ILogger')
- ->disableOriginalConstructor()->getMock();
+ $this->request = $this->createMock(IRequest::class);
+ $this->secureRandom = $this->createMock(ISecureRandom::class);
+ $this->trustedServers = $this->createMock(TrustedServers::class);
+ $this->dbHandler = $this->createMock(DbHandler::class);
+ $this->jobList = $this->createMock(JobList::class);
+ $this->logger = $this->createMock(ILogger::class);
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
+
$this->ocsAuthApi = new OCSAuthAPIController(
'federation',
@@ -80,9 +85,13 @@ class OCSAuthAPIControllerTest extends TestCase {
$this->jobList,
$this->trustedServers,
$this->dbHandler,
- $this->logger
+ $this->logger,
+ $this->timeFactory
);
+ $this->timeFactory->method('getTime')
+ ->willReturn($this->currentTime);
+
}
/**
@@ -105,9 +114,7 @@ class OCSAuthAPIControllerTest extends TestCase {
if ($ok) {
$this->jobList->expects($this->once())->method('add')
- ->with('OCA\Federation\BackgroundJob\GetSharedSecret', ['url' => $url, 'token' => $token]);
- $this->jobList->expects($this->once())->method('remove')
- ->with('OCA\Federation\BackgroundJob\RequestSharedSecret', ['url' => $url, 'token' => $localToken]);
+ ->with('OCA\Federation\BackgroundJob\GetSharedSecret', ['url' => $url, 'token' => $token, 'created' => $this->currentTime]);
} else {
$this->jobList->expects($this->never())->method('add');
$this->jobList->expects($this->never())->method('remove');
@@ -151,7 +158,8 @@ class OCSAuthAPIControllerTest extends TestCase {
$this->jobList,
$this->trustedServers,
$this->dbHandler,
- $this->logger
+ $this->logger,
+ $this->timeFactory
]
)->setMethods(['isValidToken'])->getMock();
diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php
index 598c2f01c90..5995c5e4462 100644
--- a/apps/federation/tests/TrustedServersTest.php
+++ b/apps/federation/tests/TrustedServersTest.php
@@ -29,6 +29,7 @@ namespace OCA\Federation\Tests;
use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
@@ -71,6 +72,9 @@ class TrustedServersTest extends TestCase {
/** @var \PHPUnit_Framework_MockObject_MockObject | EventDispatcherInterface */
private $dispatcher;
+ /** @var \PHPUnit_Framework_MockObject_MockObject|ITimeFactory */
+ private $timeFactory;
+
public function setUp() {
parent::setUp();
@@ -85,6 +89,7 @@ class TrustedServersTest extends TestCase {
$this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
$this->secureRandom = $this->getMockBuilder(ISecureRandom::class)->getMock();
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
$this->trustedServers = new TrustedServers(
$this->dbHandler,
@@ -93,7 +98,8 @@ class TrustedServersTest extends TestCase {
$this->jobList,
$this->secureRandom,
$this->config,
- $this->dispatcher
+ $this->dispatcher,
+ $this->timeFactory
);
}
@@ -114,13 +120,16 @@ class TrustedServersTest extends TestCase {
$this->jobList,
$this->secureRandom,
$this->config,
- $this->dispatcher
+ $this->dispatcher,
+ $this->timeFactory
]
)
->setMethods(['normalizeUrl', 'updateProtocol'])
->getMock();
$trustedServers->expects($this->once())->method('updateProtocol')
->with('url')->willReturn('https://url');
+ $this->timeFactory->method('getTime')
+ ->willReturn(1234567);
$this->dbHandler->expects($this->once())->method('addServer')->with('https://url')
->willReturn($success);
@@ -130,7 +139,7 @@ class TrustedServersTest extends TestCase {
$this->dbHandler->expects($this->once())->method('addToken')->with('https://url', 'token');
$this->jobList->expects($this->once())->method('add')
->with('OCA\Federation\BackgroundJob\RequestSharedSecret',
- ['url' => 'https://url', 'token' => 'token']);
+ ['url' => 'https://url', 'token' => 'token', 'created' => 1234567]);
} else {
$this->jobList->expects($this->never())->method('add');
}
@@ -272,7 +281,8 @@ class TrustedServersTest extends TestCase {
$this->jobList,
$this->secureRandom,
$this->config,
- $this->dispatcher
+ $this->dispatcher,
+ $this->timeFactory
]
)
->setMethods(['checkOwnCloudVersion'])
diff --git a/apps/files/l10n/ja.js b/apps/files/l10n/ja.js
index 8779fa0da2f..1d13642f842 100644
--- a/apps/files/l10n/ja.js
+++ b/apps/files/l10n/ja.js
@@ -102,7 +102,9 @@ OC.L10N.register(
"A file has been added to or removed from your <strong>favorites</strong>" : "<strong>お気に入り</strong>にファイルが追加または削除されたとき",
"A file or folder has been <strong>changed</strong> or <strong>renamed</strong>" : "ファイルまたはフォルダが <strong>更新</ strong>されたか、<strong>名前が変更</strong>されたとき",
"A new file or folder has been <strong>created</strong>" : "新しいファイルまたはフォルダーを<strong>作成</strong>したとき",
+ "A file or folder has been <strong>deleted</strong>" : "ファイルまたはフォルダーが <strong>削除されました</strong>",
"Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "<strong>お気に入りファイル</strong>の作成と変更の通知を制限する<em>(ストリームのみ)</em>",
+ "A file or folder has been <strong>restored</strong>" : "ファイルまたはフォルダーが <strong>復元されました</strong>",
"Unlimited" : "無制限",
"Upload (max. %s)" : "アップロード ( 最大 %s )",
"File handling" : "ファイル操作",
diff --git a/apps/files/l10n/ja.json b/apps/files/l10n/ja.json
index 62d9d29fdbc..99c46c8d0a6 100644
--- a/apps/files/l10n/ja.json
+++ b/apps/files/l10n/ja.json
@@ -100,7 +100,9 @@
"A file has been added to or removed from your <strong>favorites</strong>" : "<strong>お気に入り</strong>にファイルが追加または削除されたとき",
"A file or folder has been <strong>changed</strong> or <strong>renamed</strong>" : "ファイルまたはフォルダが <strong>更新</ strong>されたか、<strong>名前が変更</strong>されたとき",
"A new file or folder has been <strong>created</strong>" : "新しいファイルまたはフォルダーを<strong>作成</strong>したとき",
+ "A file or folder has been <strong>deleted</strong>" : "ファイルまたはフォルダーが <strong>削除されました</strong>",
"Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "<strong>お気に入りファイル</strong>の作成と変更の通知を制限する<em>(ストリームのみ)</em>",
+ "A file or folder has been <strong>restored</strong>" : "ファイルまたはフォルダーが <strong>復元されました</strong>",
"Unlimited" : "無制限",
"Upload (max. %s)" : "アップロード ( 最大 %s )",
"File handling" : "ファイル操作",
diff --git a/apps/files_external/l10n/ja.js b/apps/files_external/l10n/ja.js
index 9afb655d950..e76aece67ae 100644
--- a/apps/files_external/l10n/ja.js
+++ b/apps/files_external/l10n/ja.js
@@ -24,11 +24,13 @@ OC.L10N.register(
"Saving..." : "保存中...",
"Save" : "保存",
"Empty response from the server" : "サーバーから空の応答がありました",
+ "Couldn't access. Please log out and in again to activate this mount point" : "アクセスできません。ログアウトして、再度このマウントポイントをアクティベートしてください。",
"Couldn't get the information from the remote server: {code} {type}" : "リモートサーバーから情報を取得できませんでした:{code} {type}",
"Couldn't get the list of external mount points: {type}" : "外部マウントポイントのリストを取得出来ませんでした。: {type}",
"There was an error with message: " : "メッセージ付きのエラーが発生しました:",
"External mount error" : "外部マウントエラー",
"external-storage" : "外部ストレージ",
+ "Couldn't fetch list of Windows network drive mount points: Empty response from server" : "Windowsネットワークドライブのマウントポイントのリストが取得できませんでした: サーバーからのレスポンスは空でした。",
"Some of the configured external mount points are not connected. Please click on the red row(s) for more information" : "いくつかの設定済み外部マウントポイントに接続できませんでした。詳細情報は赤い行をクリックしてください",
"Please enter the credentials for the {mount} mount" : " {mount} のマウントのために必要な資格情報を入力してください",
"Username" : "ユーザー名",
diff --git a/apps/files_external/l10n/ja.json b/apps/files_external/l10n/ja.json
index a1997a0c136..09243f9b1c7 100644
--- a/apps/files_external/l10n/ja.json
+++ b/apps/files_external/l10n/ja.json
@@ -22,11 +22,13 @@
"Saving..." : "保存中...",
"Save" : "保存",
"Empty response from the server" : "サーバーから空の応答がありました",
+ "Couldn't access. Please log out and in again to activate this mount point" : "アクセスできません。ログアウトして、再度このマウントポイントをアクティベートしてください。",
"Couldn't get the information from the remote server: {code} {type}" : "リモートサーバーから情報を取得できませんでした:{code} {type}",
"Couldn't get the list of external mount points: {type}" : "外部マウントポイントのリストを取得出来ませんでした。: {type}",
"There was an error with message: " : "メッセージ付きのエラーが発生しました:",
"External mount error" : "外部マウントエラー",
"external-storage" : "外部ストレージ",
+ "Couldn't fetch list of Windows network drive mount points: Empty response from server" : "Windowsネットワークドライブのマウントポイントのリストが取得できませんでした: サーバーからのレスポンスは空でした。",
"Some of the configured external mount points are not connected. Please click on the red row(s) for more information" : "いくつかの設定済み外部マウントポイントに接続できませんでした。詳細情報は赤い行をクリックしてください",
"Please enter the credentials for the {mount} mount" : " {mount} のマウントのために必要な資格情報を入力してください",
"Username" : "ユーザー名",
diff --git a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php
index 5d2c168e876..9df0229ab8c 100644
--- a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php
@@ -3,6 +3,7 @@
namespace OCA\Files_Sharing\Middleware;
use OCA\Files_Sharing\Controller\ShareAPIController;
+use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\OCS\OCSNotFoundException;
@@ -22,7 +23,7 @@ class OCSShareAPIMiddleware extends Middleware {
}
/**
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
*
* @throws OCSNotFoundException
@@ -36,7 +37,7 @@ class OCSShareAPIMiddleware extends Middleware {
}
/**
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
* @param Response $response
* @return Response
diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
index 9dd8d2e5ae9..e1a77fdec30 100644
--- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
@@ -28,6 +28,7 @@ namespace OCA\Files_Sharing\Middleware;
use OCA\Files_Sharing\Controller\ExternalSharesController;
use OCA\Files_Sharing\Controller\ShareController;
use OCP\App\IAppManager;
+use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Middleware;
use OCP\Files\NotFoundException;
@@ -85,7 +86,7 @@ class SharingCheckMiddleware extends Middleware {
/**
* Check if sharing is enabled before the controllers is executed
*
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
* @throws NotFoundException
* @throws S2SException
@@ -112,7 +113,7 @@ class SharingCheckMiddleware extends Middleware {
/**
* Return 404 page in case of a not found exception
*
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
* @param \Exception $exception
* @return NotFoundResponse
diff --git a/apps/oauth2/l10n/ca.js b/apps/oauth2/l10n/ca.js
new file mode 100644
index 00000000000..dc7bad39f35
--- /dev/null
+++ b/apps/oauth2/l10n/ca.js
@@ -0,0 +1,14 @@
+OC.L10N.register(
+ "oauth2",
+ {
+ "OAuth 2.0" : "OAuth 2.0",
+ "OAuth 2.0 clients" : "clients OAuth 2.0",
+ "OAuth 2.0 allows external services to request access to %s." : "OAuth 2.0 permet que els serveis externs sol·licitin accés a %s.",
+ "Name" : "Nom",
+ "Redirection URI" : "URl redirecció",
+ "Client Identifier" : "Identificador de client",
+ "Secret" : "Secret",
+ "Add client" : "Afegir client",
+ "Add" : "Afegir"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/apps/oauth2/l10n/ca.json b/apps/oauth2/l10n/ca.json
new file mode 100644
index 00000000000..983ff83872e
--- /dev/null
+++ b/apps/oauth2/l10n/ca.json
@@ -0,0 +1,12 @@
+{ "translations": {
+ "OAuth 2.0" : "OAuth 2.0",
+ "OAuth 2.0 clients" : "clients OAuth 2.0",
+ "OAuth 2.0 allows external services to request access to %s." : "OAuth 2.0 permet que els serveis externs sol·licitin accés a %s.",
+ "Name" : "Nom",
+ "Redirection URI" : "URl redirecció",
+ "Client Identifier" : "Identificador de client",
+ "Secret" : "Secret",
+ "Add client" : "Afegir client",
+ "Add" : "Afegir"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php b/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php
index d9afe596027..e21f9b22878 100644
--- a/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php
+++ b/apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php
@@ -3,6 +3,7 @@
namespace OCA\Provisioning_API\Middleware;
use OCA\Provisioning_API\Middleware\Exceptions\NotSubAdminException;
+use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\OCS\OCSException;
@@ -36,7 +37,7 @@ class ProvisioningApiMiddleware extends Middleware {
}
/**
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
*
* @throws NotSubAdminException
@@ -48,7 +49,7 @@ class ProvisioningApiMiddleware extends Middleware {
}
/**
- * @param \OCP\AppFramework\Controller $controller
+ * @param Controller $controller
* @param string $methodName
* @param \Exception $exception
* @throws \Exception
@@ -61,4 +62,4 @@ class ProvisioningApiMiddleware extends Middleware {
throw $exception;
}
-} \ No newline at end of file
+}
diff --git a/apps/systemtags/l10n/lv.js b/apps/systemtags/l10n/lv.js
index c18aca68c8f..116f7a366ec 100644
--- a/apps/systemtags/l10n/lv.js
+++ b/apps/systemtags/l10n/lv.js
@@ -28,13 +28,22 @@ OC.L10N.register(
"{actor} deleted system tag {systemtag}" : "{actor} izdzēsa sistēmas atzīmi {systemtag}",
"You updated system tag %2$s to %1$s" : "Tu atjaunoji sistēmas atzīmi %2$s uz %1$s",
"You updated system tag {oldsystemtag} to {newsystemtag}" : "Jūs atjaunināt sistēmas atzīmi {oldsystemtag} uz {newsystemtag}",
+ "%1$s updated system tag %3$s to %2$s" : "%1$spārmainija sistēmas atzīmi %3$s uz %2$s",
+ "{actor} updated system tag {oldsystemtag} to {newsystemtag}" : "{actor} atjaunināja sistēmas atzīmi {oldsystemtag} uz {newsystemtag}",
"You added system tag %2$s to %1$s" : "Tu pievienoji sistēmas atzīmi %2$s uz %1$s",
+ "You added system tag {systemtag} to {file}" : "Tu pievienoji sistēmas atzīmi {systemtag} failam {file}",
+ "%1$s added system tag %3$s to %2$s" : "%1$spievienoja sistēmas atzīmi %3$s uz %2$s",
"{actor} added system tag {systemtag} to {file}" : "{actor} added system tag {systemtag} to {file}",
"You removed system tag %2$s from %1$s" : "Tu noņēmi sistēmas atzīmi %2$s no %1$s",
"You removed system tag {systemtag} from {file}" : "TU noņēmi sistēmas atzīmi {systemtag} no {file}",
+ "%1$s removed system tag %3$s from %2$s" : "%1$s noņēma sistēmas atzīmi %3$s no %2$s",
+ "{actor} removed system tag {systemtag} from {file}" : "{actor} noņēma sistēmas atzīmi {systemtag} no {file}",
"%s (restricted)" : "%s (ierobežots)",
"%s (invisible)" : "%s (neredzams)",
+ "<strong>System tags</strong> for a file have been modified" : "<strong>Sistēmas atzīmes</strong> failam tikušas mainītas",
"Collaborative tags" : "Sadarbības atzīmes",
+ "Create and edit collaborative tags. These tags affect all users." : "Izveido un rediģē sadarbības atzīmes. Šīs atzīmes ietekmē visus lietotājus.",
+ "Select tag …" : "Izvēlies atzīmi...",
"Name" : "Nosaukums",
"Delete" : "Dzēst",
"Public" : "Publisks",
diff --git a/apps/systemtags/l10n/lv.json b/apps/systemtags/l10n/lv.json
index f73c14c6e24..7359422ea9e 100644
--- a/apps/systemtags/l10n/lv.json
+++ b/apps/systemtags/l10n/lv.json
@@ -26,13 +26,22 @@
"{actor} deleted system tag {systemtag}" : "{actor} izdzēsa sistēmas atzīmi {systemtag}",
"You updated system tag %2$s to %1$s" : "Tu atjaunoji sistēmas atzīmi %2$s uz %1$s",
"You updated system tag {oldsystemtag} to {newsystemtag}" : "Jūs atjaunināt sistēmas atzīmi {oldsystemtag} uz {newsystemtag}",
+ "%1$s updated system tag %3$s to %2$s" : "%1$spārmainija sistēmas atzīmi %3$s uz %2$s",
+ "{actor} updated system tag {oldsystemtag} to {newsystemtag}" : "{actor} atjaunināja sistēmas atzīmi {oldsystemtag} uz {newsystemtag}",
"You added system tag %2$s to %1$s" : "Tu pievienoji sistēmas atzīmi %2$s uz %1$s",
+ "You added system tag {systemtag} to {file}" : "Tu pievienoji sistēmas atzīmi {systemtag} failam {file}",
+ "%1$s added system tag %3$s to %2$s" : "%1$spievienoja sistēmas atzīmi %3$s uz %2$s",
"{actor} added system tag {systemtag} to {file}" : "{actor} added system tag {systemtag} to {file}",
"You removed system tag %2$s from %1$s" : "Tu noņēmi sistēmas atzīmi %2$s no %1$s",
"You removed system tag {systemtag} from {file}" : "TU noņēmi sistēmas atzīmi {systemtag} no {file}",
+ "%1$s removed system tag %3$s from %2$s" : "%1$s noņēma sistēmas atzīmi %3$s no %2$s",
+ "{actor} removed system tag {systemtag} from {file}" : "{actor} noņēma sistēmas atzīmi {systemtag} no {file}",
"%s (restricted)" : "%s (ierobežots)",
"%s (invisible)" : "%s (neredzams)",
+ "<strong>System tags</strong> for a file have been modified" : "<strong>Sistēmas atzīmes</strong> failam tikušas mainītas",
"Collaborative tags" : "Sadarbības atzīmes",
+ "Create and edit collaborative tags. These tags affect all users." : "Izveido un rediģē sadarbības atzīmes. Šīs atzīmes ietekmē visus lietotājus.",
+ "Select tag …" : "Izvēlies atzīmi...",
"Name" : "Nosaukums",
"Delete" : "Dzēst",
"Public" : "Publisks",
diff --git a/apps/theming/l10n/ca.js b/apps/theming/l10n/ca.js
new file mode 100644
index 00000000000..ae523acb2b1
--- /dev/null
+++ b/apps/theming/l10n/ca.js
@@ -0,0 +1,31 @@
+OC.L10N.register(
+ "theming",
+ {
+ "Loading preview…" : "Carregant vista prèvia ...",
+ "Saved" : "Guardat",
+ "Admin" : "Admin",
+ "a safe home for all your data" : "un lloc segur per a les teves dades",
+ "The given name is too long" : "El nom introduït és massa llarg",
+ "The given web address is too long" : "L'adreça web proporcionada és massa llarga",
+ "The given slogan is too long" : "El lema indicat és massa llarg",
+ "The given color is invalid" : "El color donat no és vàlid",
+ "No file uploaded" : "No s'ha carregat cap fitxer",
+ "Unsupported image type" : "Tipus d'imatge no compatible",
+ "You are already using a custom theme" : "Ja esteu utilitzant un tema personalitzat",
+ "Theming" : "Adaptació de temes",
+ "Theming makes it possible to easily customize the look and feel of your instance and supported clients. This will be visible for all users." : "L'adaptació de temes permet personalitzar fàcilment l'aspecte de la vostra instància i els clients compatibles. Això serà visible per a tots els usuaris.",
+ "Name" : "Nom",
+ "Reset to default" : "Restablir al valor predeterminat",
+ "Web address" : "Adreça web",
+ "Web address https://…" : "Adreça del servidor https://…",
+ "Slogan" : "Lema",
+ "Color" : "Color",
+ "Logo" : "Logotip",
+ "Upload new logo" : "Penjar un nou logotip",
+ "Login image" : "Login logo",
+ "Upload new login background" : "Carregar nou fons d'inici de sessió",
+ "Remove background image" : "Elimina la imatge de fons",
+ "reset to default" : "restablir a configuració predeterminada",
+ "Log in image" : "Imatge d'entrada"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/apps/theming/l10n/ca.json b/apps/theming/l10n/ca.json
new file mode 100644
index 00000000000..794bf8ba05c
--- /dev/null
+++ b/apps/theming/l10n/ca.json
@@ -0,0 +1,29 @@
+{ "translations": {
+ "Loading preview…" : "Carregant vista prèvia ...",
+ "Saved" : "Guardat",
+ "Admin" : "Admin",
+ "a safe home for all your data" : "un lloc segur per a les teves dades",
+ "The given name is too long" : "El nom introduït és massa llarg",
+ "The given web address is too long" : "L'adreça web proporcionada és massa llarga",
+ "The given slogan is too long" : "El lema indicat és massa llarg",
+ "The given color is invalid" : "El color donat no és vàlid",
+ "No file uploaded" : "No s'ha carregat cap fitxer",
+ "Unsupported image type" : "Tipus d'imatge no compatible",
+ "You are already using a custom theme" : "Ja esteu utilitzant un tema personalitzat",
+ "Theming" : "Adaptació de temes",
+ "Theming makes it possible to easily customize the look and feel of your instance and supported clients. This will be visible for all users." : "L'adaptació de temes permet personalitzar fàcilment l'aspecte de la vostra instància i els clients compatibles. Això serà visible per a tots els usuaris.",
+ "Name" : "Nom",
+ "Reset to default" : "Restablir al valor predeterminat",
+ "Web address" : "Adreça web",
+ "Web address https://…" : "Adreça del servidor https://…",
+ "Slogan" : "Lema",
+ "Color" : "Color",
+ "Logo" : "Logotip",
+ "Upload new logo" : "Penjar un nou logotip",
+ "Login image" : "Login logo",
+ "Upload new login background" : "Carregar nou fons d'inici de sessió",
+ "Remove background image" : "Elimina la imatge de fons",
+ "reset to default" : "restablir a configuració predeterminada",
+ "Log in image" : "Imatge d'entrada"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/apps/theming/l10n/ja.js b/apps/theming/l10n/ja.js
index c900a8adb40..7cf3019f55f 100644
--- a/apps/theming/l10n/ja.js
+++ b/apps/theming/l10n/ja.js
@@ -4,6 +4,7 @@ OC.L10N.register(
"Loading preview…" : "プレビューを読込み中...",
"Saved" : "保存済み",
"Admin" : "管理者",
+ "a safe home for all your data" : "あなたのデータを安全に保管するプラットフォーム",
"The given name is too long" : "名前が長すぎます",
"The given web address is too long" : "Webアドレスが長すぎます",
"The given slogan is too long" : "スローガンが長すぎます",
diff --git a/apps/theming/l10n/ja.json b/apps/theming/l10n/ja.json
index 48fe11440ea..69c37a17500 100644
--- a/apps/theming/l10n/ja.json
+++ b/apps/theming/l10n/ja.json
@@ -2,6 +2,7 @@
"Loading preview…" : "プレビューを読込み中...",
"Saved" : "保存済み",
"Admin" : "管理者",
+ "a safe home for all your data" : "あなたのデータを安全に保管するプラットフォーム",
"The given name is too long" : "名前が長すぎます",
"The given web address is too long" : "Webアドレスが長すぎます",
"The given slogan is too long" : "スローガンが長すぎます",
diff --git a/apps/theming/l10n/lv.js b/apps/theming/l10n/lv.js
new file mode 100644
index 00000000000..e579c6338f9
--- /dev/null
+++ b/apps/theming/l10n/lv.js
@@ -0,0 +1,31 @@
+OC.L10N.register(
+ "theming",
+ {
+ "Loading preview…" : "Ielādē priekšskatījumu...",
+ "Saved" : "Saglabāts",
+ "Admin" : "Admin",
+ "a safe home for all your data" : "droša vieta visiem jūsu datiem",
+ "The given name is too long" : "Norādītais nosaukums ir pārāk garš",
+ "The given web address is too long" : "Norādītā adrese ir pārāk gara",
+ "The given slogan is too long" : "Norādītais teiciens ir pārāk garšs",
+ "The given color is invalid" : "Norādītā krāsa ir nederīga",
+ "No file uploaded" : "Nav augšupielādēta faila",
+ "Unsupported image type" : "Neatbalstīts attēla tips",
+ "You are already using a custom theme" : "Tu jau izmanto pielāgotu tēmu",
+ "Theming" : "Dizains",
+ "Theming makes it possible to easily customize the look and feel of your instance and supported clients. This will be visible for all users." : "Tēmošana padara iespējamu viegli pielāgot savas instances un atbalstošo klientaplikāciju izskatu un sajūtu. Tas būs redzams visiem lietotājiem.",
+ "Name" : "Nosaukums",
+ "Reset to default" : "Atiestatīt",
+ "Web address" : "Tīmekļa adrese",
+ "Web address https://…" : "Servera adrese https://…",
+ "Slogan" : "Sauklis",
+ "Color" : "Krāsa",
+ "Logo" : "Logo",
+ "Upload new logo" : "Augšupielādēt jaunu logo",
+ "Login image" : "Pieslēgšanās fona attēls",
+ "Upload new login background" : "Augšupielādēt jaunu pieslēgšanās fona attēlu",
+ "Remove background image" : "Noņemt fona attēlu",
+ "reset to default" : "Atiestatīt",
+ "Log in image" : "Pieslēgšanas fona attēls"
+},
+"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);");
diff --git a/apps/theming/l10n/lv.json b/apps/theming/l10n/lv.json
new file mode 100644
index 00000000000..6c0bbaa90a8
--- /dev/null
+++ b/apps/theming/l10n/lv.json
@@ -0,0 +1,29 @@
+{ "translations": {
+ "Loading preview…" : "Ielādē priekšskatījumu...",
+ "Saved" : "Saglabāts",
+ "Admin" : "Admin",
+ "a safe home for all your data" : "droša vieta visiem jūsu datiem",
+ "The given name is too long" : "Norādītais nosaukums ir pārāk garš",
+ "The given web address is too long" : "Norādītā adrese ir pārāk gara",
+ "The given slogan is too long" : "Norādītais teiciens ir pārāk garšs",
+ "The given color is invalid" : "Norādītā krāsa ir nederīga",
+ "No file uploaded" : "Nav augšupielādēta faila",
+ "Unsupported image type" : "Neatbalstīts attēla tips",
+ "You are already using a custom theme" : "Tu jau izmanto pielāgotu tēmu",
+ "Theming" : "Dizains",
+ "Theming makes it possible to easily customize the look and feel of your instance and supported clients. This will be visible for all users." : "Tēmošana padara iespējamu viegli pielāgot savas instances un atbalstošo klientaplikāciju izskatu un sajūtu. Tas būs redzams visiem lietotājiem.",
+ "Name" : "Nosaukums",
+ "Reset to default" : "Atiestatīt",
+ "Web address" : "Tīmekļa adrese",
+ "Web address https://…" : "Servera adrese https://…",
+ "Slogan" : "Sauklis",
+ "Color" : "Krāsa",
+ "Logo" : "Logo",
+ "Upload new logo" : "Augšupielādēt jaunu logo",
+ "Login image" : "Pieslēgšanās fona attēls",
+ "Upload new login background" : "Augšupielādēt jaunu pieslēgšanās fona attēlu",
+ "Remove background image" : "Noņemt fona attēlu",
+ "reset to default" : "Atiestatīt",
+ "Log in image" : "Pieslēgšanas fona attēls"
+},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);"
+} \ No newline at end of file
diff --git a/apps/updatenotification/css/admin.css b/apps/updatenotification/css/admin.css
new file mode 100644
index 00000000000..59c8f056fbc
--- /dev/null
+++ b/apps/updatenotification/css/admin.css
@@ -0,0 +1,3 @@
+#oca_updatenotification_section p {
+ margin: 25px 0;
+}
diff --git a/apps/updatenotification/l10n/is.js b/apps/updatenotification/l10n/is.js
index f6b3825b56b..801b6f7c3fe 100644
--- a/apps/updatenotification/l10n/is.js
+++ b/apps/updatenotification/l10n/is.js
@@ -18,6 +18,7 @@ OC.L10N.register(
"Checked on %s" : "Athugað þann %s",
"Update channel:" : "Uppfærslurás:",
"You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel." : "Þú getur alltaf uppfært í nýrri útgáfu eða tilraunaútgáfurás. En þú getur aldrei niðurfært í stöðugri rás.",
+ "Note that after a new release it can take some time before it shows up here. We roll out new versions spread out over time to our users and sometimes skip a version when issues are found." : "Athugaðu að það getur tekið nokkurn tíma áður en nýjar útgáfur birtast hér. Við dreifum útgáfum yfir tíma auk þess sem stundum er útgáfum sleppt ef í þeim finnast hnökrar.",
"Notify members of the following groups about available updates:" : "Tilkynna meðlimum eftirfarandi hópa um tiltækar uppfærslur:",
"Only notification for app updates are available." : "Eingöngu eru eru tiltækar tilkynningar fyrir uppfærslur forrita.",
"The selected update channel makes dedicated notifications for the server obsolete." : "Valda uppfærslurásin gerir úreltar sértækar tilkynningar fyrir vefþjóninn.",
diff --git a/apps/updatenotification/l10n/is.json b/apps/updatenotification/l10n/is.json
index c24c469b2f2..8ff7e4a004f 100644
--- a/apps/updatenotification/l10n/is.json
+++ b/apps/updatenotification/l10n/is.json
@@ -16,6 +16,7 @@
"Checked on %s" : "Athugað þann %s",
"Update channel:" : "Uppfærslurás:",
"You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel." : "Þú getur alltaf uppfært í nýrri útgáfu eða tilraunaútgáfurás. En þú getur aldrei niðurfært í stöðugri rás.",
+ "Note that after a new release it can take some time before it shows up here. We roll out new versions spread out over time to our users and sometimes skip a version when issues are found." : "Athugaðu að það getur tekið nokkurn tíma áður en nýjar útgáfur birtast hér. Við dreifum útgáfum yfir tíma auk þess sem stundum er útgáfum sleppt ef í þeim finnast hnökrar.",
"Notify members of the following groups about available updates:" : "Tilkynna meðlimum eftirfarandi hópa um tiltækar uppfærslur:",
"Only notification for app updates are available." : "Eingöngu eru eru tiltækar tilkynningar fyrir uppfærslur forrita.",
"The selected update channel makes dedicated notifications for the server obsolete." : "Valda uppfærslurásin gerir úreltar sértækar tilkynningar fyrir vefþjóninn.",
diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php
index 0a867f1267c..fd68a6dd962 100644
--- a/apps/updatenotification/lib/Controller/AdminController.php
+++ b/apps/updatenotification/lib/Controller/AdminController.php
@@ -86,9 +86,8 @@ class AdminController extends Controller implements ISettings {
* @return TemplateResponse
*/
public function displayPanel() {
- $lastUpdateCheck = $this->dateTimeFormatter->formatDateTime(
- $this->config->getAppValue('core', 'lastupdatedat')
- );
+ $lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
+ $lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
$channels = [
'daily',
@@ -106,15 +105,20 @@ class AdminController extends Controller implements ISettings {
$notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'), true);
+ $defaultUpdateServerURL = 'https://updates.nextcloud.com/server/';
+ $updateServerURL = $this->config->getSystemValue('updater.server.url', $defaultUpdateServerURL);
+
$params = [
'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
+ 'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'],
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
'updaterEnabled' => (empty($updateState['updaterEnabled'])) ? false : $updateState['updaterEnabled'],
-
+ 'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
+ 'updateServerURL' => $updateServerURL,
'notify_groups' => implode('|', $notifyGroups),
];
diff --git a/apps/updatenotification/templates/admin.php b/apps/updatenotification/templates/admin.php
index 369d4905a40..e09d19848e7 100644
--- a/apps/updatenotification/templates/admin.php
+++ b/apps/updatenotification/templates/admin.php
@@ -1,31 +1,50 @@
<?php
script('updatenotification', 'admin');
+ style('updatenotification', 'admin');
/** @var array $_ */
/** @var bool $isNewVersionAvailable */
$isNewVersionAvailable = $_['isNewVersionAvailable'];
/** @var string $newVersionString */
$newVersionString = $_['newVersionString'];
+ /** @var bool $isUpdateChecked */
+ $isUpdateChecked = $_['isUpdateChecked'];
/** @var string $lastCheckedDate */
$lastCheckedDate = $_['lastChecked'];
/** @var array $channels */
$channels = $_['channels'];
/** @var string $currentChannel */
$currentChannel = $_['currentChannel'];
+ /** @var string $updateServerURL */
+ $updateServerURL = $_['updateServerURL'];
+ /** @var bool $isDefaultUpdateServerURL */
+ $isDefaultUpdateServerURL = $_['isDefaultUpdateServerURL'];
?>
<form id="oca_updatenotification_section" class="followupsection">
- <?php if($isNewVersionAvailable === true) { ?>
- <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong>
- <?php if ($_['updaterEnabled']) { ?>
- <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>">
+ <p>
+ <?php if ($isNewVersionAvailable === true) { ?>
+ <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong>
+ <?php if ($_['updaterEnabled']) { ?>
+ <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>">
+ <?php } ?>
+ <?php if (!empty($_['downloadLink'])) { ?>
+ <a href="<?php p($_['downloadLink']); ?>" class="button<?php if ($_['updaterEnabled']) { p(' hidden'); } ?>"><?php p($l->t('Download now')) ?></a>
+ <?php } ?>
+ <?php } elseif (!$isUpdateChecked) { ?>
+ <?php p($l->t('The update check is not yet finished. Please refresh the page.')); ?>
+ <?php } else { ?>
+ <?php p($l->t('Your version is up to date.')); ?>
+ <span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span>
<?php } ?>
- <?php if (!empty($_['downloadLink'])) { ?>
- <a href="<?php p($_['downloadLink']); ?>" class="button<?php if ($_['updaterEnabled']) { p(' hidden'); } ?>"><?php p($l->t('Download now')) ?></a>
+
+ <?php if (!$isDefaultUpdateServerURL) { ?>
+ <br />
+ <em>
+ <?php p($l->t("A non-default update server is in use to be checked for updates:")); ?>
+ <code><?php p($updateServerURL); ?></code>
+ </em>
<?php } ?>
- <?php } else { ?>
- <?php p($l->t('Your version is up to date.')); ?>
- <span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span>
- <?php } ?>
+ </p>
<p>
<label for="release-channel"><?php p($l->t('Update channel:')) ?></label>
@@ -37,20 +56,16 @@
</option>
<?php } ?>
</select>
- <span id="channel_save_msg" class="msg"></span>
- </p>
- <p>
- <em><?php p($l->t('You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel.')); ?></em>
+ <span id="channel_save_msg" class="msg"></span><br />
+ <em><?php p($l->t('You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel.')); ?></em><br />
<em><?php p($l->t('Note that after a new release it can take some time before it shows up here. We roll out new versions spread out over time to our users and sometimes skip a version when issues are found.')); ?></em>
</p>
<p id="oca_updatenotification_groups">
- <br />
<?php p($l->t('Notify members of the following groups about available updates:')); ?>
- <input name="oca_updatenotification_groups_list" type="hidden" id="oca_updatenotification_groups_list" value="<?php p($_['notify_groups']) ?>" style="width: 400px">
+ <input name="oca_updatenotification_groups_list" type="hidden" id="oca_updatenotification_groups_list" value="<?php p($_['notify_groups']) ?>" style="width: 400px"><br />
<em class="<?php if (!in_array($currentChannel, ['daily', 'git'])) p('hidden'); ?>">
- <br />
<?php p($l->t('Only notification for app updates are available.')); ?>
<?php if ($currentChannel === 'daily') p($l->t('The selected update channel makes dedicated notifications for the server obsolete.')); ?>
<?php if ($currentChannel === 'git') p($l->t('The selected update channel does not support updates of the server.')); ?>
diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php
index 31e852a9e2e..ebf044abffd 100644
--- a/apps/updatenotification/tests/Controller/AdminControllerTest.php
+++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php
@@ -103,6 +103,11 @@ class AdminControllerTest extends TestCase {
['core', 'lastupdatedat', '', '12345'],
['updatenotification', 'notify_groups', '["admin"]', '["admin"]'],
]);
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('updater.server.url', 'https://updates.nextcloud.com/server/')
+ ->willReturn('https://updates.nextcloud.com/server/');
$this->dateTimeFormatter
->expects($this->once())
->method('formatDateTime')
@@ -120,12 +125,15 @@ class AdminControllerTest extends TestCase {
$params = [
'isNewVersionAvailable' => true,
+ 'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels,
'newVersionString' => '8.1.2',
'downloadLink' => 'https://downloads.nextcloud.org/server',
'updaterEnabled' => true,
+ 'isDefaultUpdateServerURL' => true,
+ 'updateServerURL' => 'https://updates.nextcloud.com/server/',
'notify_groups' => 'admin',
];
@@ -154,6 +162,11 @@ class AdminControllerTest extends TestCase {
['core', 'lastupdatedat', '', '12345'],
['updatenotification', 'notify_groups', '["admin"]', '["admin"]'],
]);
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('updater.server.url', 'https://updates.nextcloud.com/server/')
+ ->willReturn('https://updates.nextcloud.com/server/');
$this->dateTimeFormatter
->expects($this->once())
->method('formatDateTime')
@@ -166,12 +179,15 @@ class AdminControllerTest extends TestCase {
$params = [
'isNewVersionAvailable' => false,
+ 'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels,
'newVersionString' => '',
'downloadLink' => '',
'updaterEnabled' => 0,
+ 'isDefaultUpdateServerURL' => true,
+ 'updateServerURL' => 'https://updates.nextcloud.com/server/',
'notify_groups' => 'admin',
];
diff --git a/apps/workflowengine/l10n/lv.js b/apps/workflowengine/l10n/lv.js
index 3245afed086..1e96ec1d72e 100644
--- a/apps/workflowengine/l10n/lv.js
+++ b/apps/workflowengine/l10n/lv.js
@@ -3,6 +3,7 @@ OC.L10N.register(
{
"Saved" : "Saglabāts",
"Saving failed:" : "Saglabāšana neizdevās:",
+ "File MIME type" : "Faila MIME tips",
"is" : "ir",
"is not" : "nav",
"matches" : "atbilst",
@@ -58,6 +59,7 @@ OC.L10N.register(
"Check %s is invalid" : "Pārbaude %s ir nederīga",
"Check #%s does not exist" : "Pārbaude #%s nepastāv",
"Workflow" : "Darbplūsma",
+ "Files workflow engine" : "Faila darblūsmas programma",
"Open documentation" : "Atvērt dokumentāciju",
"Add rule group" : "Pievienot kārtulu grupas",
"Short rule description" : "Īss kārtulas apraksts",
diff --git a/apps/workflowengine/l10n/lv.json b/apps/workflowengine/l10n/lv.json
index fabd7d15577..90bd428f4b9 100644
--- a/apps/workflowengine/l10n/lv.json
+++ b/apps/workflowengine/l10n/lv.json
@@ -1,6 +1,7 @@
{ "translations": {
"Saved" : "Saglabāts",
"Saving failed:" : "Saglabāšana neizdevās:",
+ "File MIME type" : "Faila MIME tips",
"is" : "ir",
"is not" : "nav",
"matches" : "atbilst",
@@ -56,6 +57,7 @@
"Check %s is invalid" : "Pārbaude %s ir nederīga",
"Check #%s does not exist" : "Pārbaude #%s nepastāv",
"Workflow" : "Darbplūsma",
+ "Files workflow engine" : "Faila darblūsmas programma",
"Open documentation" : "Atvērt dokumentāciju",
"Add rule group" : "Pievienot kārtulu grupas",
"Short rule description" : "Īss kārtulas apraksts",