summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php13
-rw-r--r--lib/composer/composer/autoload_classmap.php4
-rw-r--r--lib/composer/composer/autoload_static.php4
-rw-r--r--lib/l10n/cs_CZ.js1
-rw-r--r--lib/l10n/cs_CZ.json1
-rw-r--r--lib/l10n/de.js1
-rw-r--r--lib/l10n/de.json1
-rw-r--r--lib/l10n/de_DE.js1
-rw-r--r--lib/l10n/de_DE.json1
-rw-r--r--lib/l10n/fr.js3
-rw-r--r--lib/l10n/fr.json3
-rw-r--r--lib/l10n/hu_HU.js1
-rw-r--r--lib/l10n/hu_HU.json1
-rw-r--r--lib/l10n/it.js1
-rw-r--r--lib/l10n/it.json1
-rw-r--r--lib/l10n/nl.js1
-rw-r--r--lib/l10n/nl.json1
-rw-r--r--lib/l10n/zh_TW.js45
-rw-r--r--lib/l10n/zh_TW.json45
-rw-r--r--lib/private/AllConfig.php10
-rw-r--r--lib/private/App/AppManager.php16
-rw-r--r--lib/private/Authentication/Token/DefaultToken.php33
-rw-r--r--lib/private/Authentication/Token/DefaultTokenMapper.php31
-rw-r--r--lib/private/Authentication/Token/DefaultTokenProvider.php21
-rw-r--r--lib/private/Authentication/Token/IProvider.php11
-rw-r--r--lib/private/Authentication/Token/IToken.php23
-rw-r--r--lib/private/DB/QueryBuilder/QuoteHelper.php5
-rw-r--r--lib/private/Files/Cache/Cache.php44
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php39
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheWrapper.php52
-rw-r--r--lib/private/Files/Filesystem.php45
-rw-r--r--lib/private/Lockdown/Filesystem/NullCache.php122
-rw-r--r--lib/private/Lockdown/Filesystem/NullStorage.php177
-rw-r--r--lib/private/Lockdown/LockdownManager.php46
-rw-r--r--lib/private/OCS/Person.php48
-rw-r--r--lib/private/Server.php11
-rw-r--r--lib/private/Settings/Admin/ServerDevNotice.php62
-rw-r--r--lib/private/Settings/Manager.php2
-rw-r--r--lib/private/Share20/DefaultShareProvider.php27
-rw-r--r--lib/private/Share20/Share.php18
-rw-r--r--lib/private/User/Session.php3
-rw-r--r--lib/private/legacy/app.php2
-rw-r--r--lib/public/App/AppPathNotFoundException.php31
-rw-r--r--lib/public/App/IAppManager.php10
-rw-r--r--lib/public/Lockdown/ILockdownManager.php50
-rw-r--r--lib/public/Share/IShare.php17
46 files changed, 927 insertions, 158 deletions
diff --git a/lib/base.php b/lib/base.php
index 909a62040ee..d6c6e17eff9 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -377,7 +377,7 @@ class OC {
\OCP\Util::addScript('update');
\OCP\Util::addStyle('update');
- /** @var \OCP\App\IAppManager $appManager */
+ /** @var \OC\App\AppManager $appManager */
$appManager = \OC::$server->getAppManager();
$tmpl = new OC_Template('', 'update.admin', 'guest');
@@ -387,14 +387,19 @@ class OC {
// get third party apps
$ocVersion = \OCP\Util::getVersion();
$incompatibleApps = $appManager->getIncompatibleApps($ocVersion);
+ $incompatibleShippedApps = [];
foreach ($incompatibleApps as $appInfo) {
if ($appManager->isShipped($appInfo['id'])) {
- $l = \OC::$server->getL10N('core');
- $hint = $l->t('The files of the app "%$1s" (%$2s) were not replaced correctly.', [$appInfo['name'], $appInfo['id']]);
- throw new \OC\HintException('The files of the app "' . $appInfo['name'] . '" (' . $appInfo['id'] . ') were not replaced correctly.', $hint);
+ $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')';
}
}
+ if (!empty($incompatibleShippedApps)) {
+ $l = \OC::$server->getL10N('core');
+ $hint = $l->t('The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]);
+ throw new \OC\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint);
+ }
+
$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
$tmpl->assign('incompatibleAppsList', $incompatibleApps);
$tmpl->assign('productName', 'Nextcloud'); // for now
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 42cfb8c45e1..69e8428fdea 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -189,6 +189,7 @@ return array(
'OCP\\LDAP\\ILDAPProviderFactory' => $baseDir . '/lib/public/LDAP/ILDAPProviderFactory.php',
'OCP\\Lock\\ILockingProvider' => $baseDir . '/lib/public/Lock/ILockingProvider.php',
'OCP\\Lock\\LockedException' => $baseDir . '/lib/public/Lock/LockedException.php',
+ 'OCP\\Lockdown\\ILockdownManager' => $baseDir . '/lib/public/Lockdown/ILockdownManager.php',
'OCP\\Mail\\IMailer' => $baseDir . '/lib/public/Mail/IMailer.php',
'OCP\\Migration\\IOutput' => $baseDir . '/lib/public/Migration/IOutput.php',
'OCP\\Migration\\IRepairStep' => $baseDir . '/lib/public/Migration/IRepairStep.php',
@@ -580,6 +581,9 @@ return array(
'OC\\Lock\\DBLockingProvider' => $baseDir . '/lib/private/Lock/DBLockingProvider.php',
'OC\\Lock\\MemcacheLockingProvider' => $baseDir . '/lib/private/Lock/MemcacheLockingProvider.php',
'OC\\Lock\\NoopLockingProvider' => $baseDir . '/lib/private/Lock/NoopLockingProvider.php',
+ 'OC\\Lockdown\\Filesystem\\NullCache' => $baseDir . '/lib/private/Lockdown/Filesystem/NullCache.php',
+ 'OC\\Lockdown\\Filesystem\\NullStorage' => $baseDir . '/lib/private/Lockdown/Filesystem/NullStorage.php',
+ 'OC\\Lockdown\\LockdownManager' => $baseDir . '/lib/private/Lockdown/LockdownManager.php',
'OC\\Log' => $baseDir . '/lib/private/Log.php',
'OC\\Log\\ErrorHandler' => $baseDir . '/lib/private/Log/ErrorHandler.php',
'OC\\Log\\Errorlog' => $baseDir . '/lib/private/Log/Errorlog.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index d7e937577f2..c960a35d951 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -219,6 +219,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\LDAP\\ILDAPProviderFactory' => __DIR__ . '/../../..' . '/lib/public/LDAP/ILDAPProviderFactory.php',
'OCP\\Lock\\ILockingProvider' => __DIR__ . '/../../..' . '/lib/public/Lock/ILockingProvider.php',
'OCP\\Lock\\LockedException' => __DIR__ . '/../../..' . '/lib/public/Lock/LockedException.php',
+ 'OCP\\Lockdown\\ILockdownManager' => __DIR__ . '/../../..' . '/lib/public/Lockdown/ILockdownManager.php',
'OCP\\Mail\\IMailer' => __DIR__ . '/../../..' . '/lib/public/Mail/IMailer.php',
'OCP\\Migration\\IOutput' => __DIR__ . '/../../..' . '/lib/public/Migration/IOutput.php',
'OCP\\Migration\\IRepairStep' => __DIR__ . '/../../..' . '/lib/public/Migration/IRepairStep.php',
@@ -610,6 +611,9 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Lock\\DBLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/DBLockingProvider.php',
'OC\\Lock\\MemcacheLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/MemcacheLockingProvider.php',
'OC\\Lock\\NoopLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/NoopLockingProvider.php',
+ 'OC\\Lockdown\\Filesystem\\NullCache' => __DIR__ . '/../../..' . '/lib/private/Lockdown/Filesystem/NullCache.php',
+ 'OC\\Lockdown\\Filesystem\\NullStorage' => __DIR__ . '/../../..' . '/lib/private/Lockdown/Filesystem/NullStorage.php',
+ 'OC\\Lockdown\\LockdownManager' => __DIR__ . '/../../..' . '/lib/private/Lockdown/LockdownManager.php',
'OC\\Log' => __DIR__ . '/../../..' . '/lib/private/Log.php',
'OC\\Log\\ErrorHandler' => __DIR__ . '/../../..' . '/lib/private/Log/ErrorHandler.php',
'OC\\Log\\Errorlog' => __DIR__ . '/../../..' . '/lib/private/Log/Errorlog.php',
diff --git a/lib/l10n/cs_CZ.js b/lib/l10n/cs_CZ.js
index c4bb85acd64..97a57585936 100644
--- a/lib/l10n/cs_CZ.js
+++ b/lib/l10n/cs_CZ.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "To lze obvykle vyřešit povolením zápisu webovému serveru do konfiguračního adresáře",
"See %s" : "Viz %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "To lze obvykle vyřešit %spovolením zápisu webovému serveru do konfiguračního adresáře%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Soubory aplikace \"%$1s\" (%$2s) nebyly řádně nahrazeny.",
"Sample configuration detected" : "Byla detekována vzorová konfigurace",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Pravděpodobně byla zkopírována konfigurační nastavení ze vzorových souborů. Toto není podporováno a může poškodit vaši instalaci. Nahlédněte prosím do dokumentace před prováděním změn v souboru config.php",
"PHP %s or higher is required." : "Je vyžadováno PHP %s nebo vyšší.",
diff --git a/lib/l10n/cs_CZ.json b/lib/l10n/cs_CZ.json
index 9514c96394a..f352a8db458 100644
--- a/lib/l10n/cs_CZ.json
+++ b/lib/l10n/cs_CZ.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "To lze obvykle vyřešit povolením zápisu webovému serveru do konfiguračního adresáře",
"See %s" : "Viz %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "To lze obvykle vyřešit %spovolením zápisu webovému serveru do konfiguračního adresáře%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Soubory aplikace \"%$1s\" (%$2s) nebyly řádně nahrazeny.",
"Sample configuration detected" : "Byla detekována vzorová konfigurace",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Pravděpodobně byla zkopírována konfigurační nastavení ze vzorových souborů. Toto není podporováno a může poškodit vaši instalaci. Nahlédněte prosím do dokumentace před prováděním změn v souboru config.php",
"PHP %s or higher is required." : "Je vyžadováno PHP %s nebo vyšší.",
diff --git a/lib/l10n/de.js b/lib/l10n/de.js
index 28a4da2419e..8f6047acb47 100644
--- a/lib/l10n/de.js
+++ b/lib/l10n/de.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "Dies kann normalerweise repariert werden, indem dem Webserver Schreibzugriff auf das config-Verzeichnis gegeben wird",
"See %s" : "Siehe %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Dies kann normalerweise behoben werden, %sindem dem Webserver Schreibzugriff auf das Konfigurationsverzeichnis gegeben wird%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Die Dateien der App \"%$1s\" (%$2s) wurden nicht korrekt ersetzt.",
"Sample configuration detected" : "Beispielkonfiguration gefunden",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Es wurde festgestellt, dass die Beispielkonfiguration kopiert wurde. Dies kann Ihre Installation zunichte machen und wird nicht unterstützt. Bitte die Dokumentation lesen, bevor Änderungen an der config.php vorgenommen werden.",
"PHP %s or higher is required." : "PHP %s oder höher wird benötigt.",
diff --git a/lib/l10n/de.json b/lib/l10n/de.json
index 163965e2689..30bbe1e9b3b 100644
--- a/lib/l10n/de.json
+++ b/lib/l10n/de.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "Dies kann normalerweise repariert werden, indem dem Webserver Schreibzugriff auf das config-Verzeichnis gegeben wird",
"See %s" : "Siehe %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Dies kann normalerweise behoben werden, %sindem dem Webserver Schreibzugriff auf das Konfigurationsverzeichnis gegeben wird%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Die Dateien der App \"%$1s\" (%$2s) wurden nicht korrekt ersetzt.",
"Sample configuration detected" : "Beispielkonfiguration gefunden",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Es wurde festgestellt, dass die Beispielkonfiguration kopiert wurde. Dies kann Ihre Installation zunichte machen und wird nicht unterstützt. Bitte die Dokumentation lesen, bevor Änderungen an der config.php vorgenommen werden.",
"PHP %s or higher is required." : "PHP %s oder höher wird benötigt.",
diff --git a/lib/l10n/de_DE.js b/lib/l10n/de_DE.js
index a71b7cf72c6..1fd8fdc18ce 100644
--- a/lib/l10n/de_DE.js
+++ b/lib/l10n/de_DE.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "Dies kann normalerweise repariert werden, indem dem Webserver Schreibzugriff auf das config-Verzeichnis gegeben wird",
"See %s" : "Siehe %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Dies kann normalerweise behoben werden, %sindem dem Webserver Schreibzugriff auf das Konfigurationsverzeichnis gegeben wird%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Die Dateien der App \"%$1s\" (%$2s) wurden nicht korrekt ersetzt.",
"Sample configuration detected" : "Beispielkonfiguration gefunden",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Es wurde festgestellt, dass die Beispielkonfiguration kopiert wurde. Dies kann Ihre Installation zerstören und wird nicht unterstützt. Bitte lesen Sie die Dokumentation, bevor Sie Änderungen an der config.php vornehmen.",
"PHP %s or higher is required." : "PHP %s oder höher wird benötigt.",
diff --git a/lib/l10n/de_DE.json b/lib/l10n/de_DE.json
index 8d2953651e5..7fa221231c2 100644
--- a/lib/l10n/de_DE.json
+++ b/lib/l10n/de_DE.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "Dies kann normalerweise repariert werden, indem dem Webserver Schreibzugriff auf das config-Verzeichnis gegeben wird",
"See %s" : "Siehe %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Dies kann normalerweise behoben werden, %sindem dem Webserver Schreibzugriff auf das Konfigurationsverzeichnis gegeben wird%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Die Dateien der App \"%$1s\" (%$2s) wurden nicht korrekt ersetzt.",
"Sample configuration detected" : "Beispielkonfiguration gefunden",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Es wurde festgestellt, dass die Beispielkonfiguration kopiert wurde. Dies kann Ihre Installation zerstören und wird nicht unterstützt. Bitte lesen Sie die Dokumentation, bevor Sie Änderungen an der config.php vornehmen.",
"PHP %s or higher is required." : "PHP %s oder höher wird benötigt.",
diff --git a/lib/l10n/fr.js b/lib/l10n/fr.js
index 545ee1d23b5..b1b76991b2b 100644
--- a/lib/l10n/fr.js
+++ b/lib/l10n/fr.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "Ce problème est généralement résolu en donnant au serveur web un accès en écriture au répertoire \"config\"",
"See %s" : "Voir %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Ce problème est généralement résolu %sen donnant au serveur web un accès en écriture au répertoire de configuration%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Les fichiers de l'application « %$1s » (%$2s) n'ont pas été remplacés correctement.",
"Sample configuration detected" : "Configuration d'exemple détectée",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Il a été détecté que la configuration donnée à titre d'exemple a été copiée. Cela peut rendre votre installation inopérante et n'est pas pris en charge. Veuillez lire la documentation avant d'effectuer des modifications dans config.php",
"PHP %s or higher is required." : "PHP %s ou supérieur est requis.",
@@ -21,6 +20,7 @@ OC.L10N.register(
"Server version %s or lower is required." : "Un serveur de version %s ou inférieure est requis.",
"Unknown filetype" : "Type de fichier inconnu",
"Invalid image" : "Image non valable",
+ "Avatar image is not square" : "L'image d'avatar n'est pas carré",
"today" : "aujourd'hui",
"yesterday" : "hier",
"_%n day ago_::_%n days ago_" : ["il y a %n jour","il y a %n jours"],
@@ -203,6 +203,7 @@ OC.L10N.register(
"Storage unauthorized. %s" : "Espace de stockage non autorisé. %s",
"Storage incomplete configuration. %s" : "Configuration de l'espace de stockage incomplète. %s",
"Storage connection error. %s" : "Erreur de connexion à l'espace stockage. %s",
+ "Storage is temporarily not available" : "Le support de stockage est temporairement indisponible",
"Storage connection timeout. %s" : "Le délai d'attente pour la connexion à l'espace de stockage a été dépassé. %s",
"App directory already exists" : "Le dossier de l'application existe déjà",
"Can't create app folder. Please fix permissions. %s" : "Impossible de créer le dossier de l'application. Corrigez les droits d'accès. %s",
diff --git a/lib/l10n/fr.json b/lib/l10n/fr.json
index e810852d851..89893d2209a 100644
--- a/lib/l10n/fr.json
+++ b/lib/l10n/fr.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "Ce problème est généralement résolu en donnant au serveur web un accès en écriture au répertoire \"config\"",
"See %s" : "Voir %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Ce problème est généralement résolu %sen donnant au serveur web un accès en écriture au répertoire de configuration%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Les fichiers de l'application « %$1s » (%$2s) n'ont pas été remplacés correctement.",
"Sample configuration detected" : "Configuration d'exemple détectée",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Il a été détecté que la configuration donnée à titre d'exemple a été copiée. Cela peut rendre votre installation inopérante et n'est pas pris en charge. Veuillez lire la documentation avant d'effectuer des modifications dans config.php",
"PHP %s or higher is required." : "PHP %s ou supérieur est requis.",
@@ -19,6 +18,7 @@
"Server version %s or lower is required." : "Un serveur de version %s ou inférieure est requis.",
"Unknown filetype" : "Type de fichier inconnu",
"Invalid image" : "Image non valable",
+ "Avatar image is not square" : "L'image d'avatar n'est pas carré",
"today" : "aujourd'hui",
"yesterday" : "hier",
"_%n day ago_::_%n days ago_" : ["il y a %n jour","il y a %n jours"],
@@ -201,6 +201,7 @@
"Storage unauthorized. %s" : "Espace de stockage non autorisé. %s",
"Storage incomplete configuration. %s" : "Configuration de l'espace de stockage incomplète. %s",
"Storage connection error. %s" : "Erreur de connexion à l'espace stockage. %s",
+ "Storage is temporarily not available" : "Le support de stockage est temporairement indisponible",
"Storage connection timeout. %s" : "Le délai d'attente pour la connexion à l'espace de stockage a été dépassé. %s",
"App directory already exists" : "Le dossier de l'application existe déjà",
"Can't create app folder. Please fix permissions. %s" : "Impossible de créer le dossier de l'application. Corrigez les droits d'accès. %s",
diff --git a/lib/l10n/hu_HU.js b/lib/l10n/hu_HU.js
index 92651f45303..f3d5a740ab4 100644
--- a/lib/l10n/hu_HU.js
+++ b/lib/l10n/hu_HU.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "Ez rendszerint úgy oldható meg, hogy írási jogot adunk a webszervernek a config könyvtárra.",
"See %s" : "Lásd %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Ez rendszerint úgy oldható meg, hogy %sírási jogot adunk a webszervernek a config könyvtárra%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "\"%$1s\" (%$2s) alkalmazás fájljai nem megfelelően lettek cserélve.",
"Sample configuration detected" : "A példabeállítások vannak beállítva",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Úgy tűnik a példakonfigurációt próbálja ténylegesen használni. Ez nem támogatott, és működésképtelenné teheti a telepítést. Kérlek olvasd el a dokumentációt és azt követően változtas a config.php-n!",
"PHP %s or higher is required." : "PHP %s vagy ennél újabb szükséges.",
diff --git a/lib/l10n/hu_HU.json b/lib/l10n/hu_HU.json
index ae980944269..29e4504a895 100644
--- a/lib/l10n/hu_HU.json
+++ b/lib/l10n/hu_HU.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "Ez rendszerint úgy oldható meg, hogy írási jogot adunk a webszervernek a config könyvtárra.",
"See %s" : "Lásd %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Ez rendszerint úgy oldható meg, hogy %sírási jogot adunk a webszervernek a config könyvtárra%s.",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "\"%$1s\" (%$2s) alkalmazás fájljai nem megfelelően lettek cserélve.",
"Sample configuration detected" : "A példabeállítások vannak beállítva",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Úgy tűnik a példakonfigurációt próbálja ténylegesen használni. Ez nem támogatott, és működésképtelenné teheti a telepítést. Kérlek olvasd el a dokumentációt és azt követően változtas a config.php-n!",
"PHP %s or higher is required." : "PHP %s vagy ennél újabb szükséges.",
diff --git a/lib/l10n/it.js b/lib/l10n/it.js
index af47d8f9e17..c61ac244637 100644
--- a/lib/l10n/it.js
+++ b/lib/l10n/it.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "Ciò può essere normalmente corretto fornendo al server web accesso in scrittura alla cartella \"config\"",
"See %s" : "Vedi %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Ciò può essere normalmente corretto %sfornendo al server web accesso in scrittura alla cartella \"config\"%s",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "I file dell'applicazione \"%1$s\" (%2$s) non sono stati sostituiti correttamente.",
"Sample configuration detected" : "Configurazione di esempio rilevata",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "È stato rilevato che la configurazione di esempio è stata copiata. Ciò può compromettere la tua installazione e non è supportato. Leggi la documentazione prima di modificare il file config.php",
"PHP %s or higher is required." : "Richiesto PHP %s o superiore",
diff --git a/lib/l10n/it.json b/lib/l10n/it.json
index cb4b4139b07..4e310444042 100644
--- a/lib/l10n/it.json
+++ b/lib/l10n/it.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "Ciò può essere normalmente corretto fornendo al server web accesso in scrittura alla cartella \"config\"",
"See %s" : "Vedi %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Ciò può essere normalmente corretto %sfornendo al server web accesso in scrittura alla cartella \"config\"%s",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "I file dell'applicazione \"%1$s\" (%2$s) non sono stati sostituiti correttamente.",
"Sample configuration detected" : "Configurazione di esempio rilevata",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "È stato rilevato che la configurazione di esempio è stata copiata. Ciò può compromettere la tua installazione e non è supportato. Leggi la documentazione prima di modificare il file config.php",
"PHP %s or higher is required." : "Richiesto PHP %s o superiore",
diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js
index ed9100bfaf8..f44511d8cb2 100644
--- a/lib/l10n/nl.js
+++ b/lib/l10n/nl.js
@@ -5,7 +5,6 @@ OC.L10N.register(
"This can usually be fixed by giving the webserver write access to the config directory" : "Dit kan hersteld worden door de webserver schrijfrechten te geven op de de config directory",
"See %s" : "Zie %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Dit kan hersteld worden door de webserver %sschrijfrechten te geven op de de config directory%s",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Het bestand van de app \"%$1s\" (%$2s) zijn niet correct vervangen.",
"Sample configuration detected" : "Voorbeeldconfiguratie gevonden",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Blijkbaar is de voorbeeldconfiguratie gekopieerd. Dit kan je installatie beschadigen en wordt dan ook niet ondersteund. Lees de documentatie voordat je wijzigingen aan config.php doorvoert",
"PHP %s or higher is required." : "PHP %s of hoger vereist.",
diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json
index 53394c890ab..1cdd9430893 100644
--- a/lib/l10n/nl.json
+++ b/lib/l10n/nl.json
@@ -3,7 +3,6 @@
"This can usually be fixed by giving the webserver write access to the config directory" : "Dit kan hersteld worden door de webserver schrijfrechten te geven op de de config directory",
"See %s" : "Zie %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Dit kan hersteld worden door de webserver %sschrijfrechten te geven op de de config directory%s",
- "The files of the app \"%$1s\" (%$2s) were not replaced correctly." : "Het bestand van de app \"%$1s\" (%$2s) zijn niet correct vervangen.",
"Sample configuration detected" : "Voorbeeldconfiguratie gevonden",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Blijkbaar is de voorbeeldconfiguratie gekopieerd. Dit kan je installatie beschadigen en wordt dan ook niet ondersteund. Lees de documentatie voordat je wijzigingen aan config.php doorvoert",
"PHP %s or higher is required." : "PHP %s of hoger vereist.",
diff --git a/lib/l10n/zh_TW.js b/lib/l10n/zh_TW.js
index acba2269658..5d44d1a172e 100644
--- a/lib/l10n/zh_TW.js
+++ b/lib/l10n/zh_TW.js
@@ -100,6 +100,51 @@ OC.L10N.register(
"Expiration date is in the past" : "到期日是之前的時間",
"Cannot set expiration date more than %s days in the future" : "無法設定到期日超過未來%s天",
"Could not find category \"%s\"" : "找不到分類:\"%s\"",
+ "Sunday" : "週日",
+ "Monday" : "週一",
+ "Tuesday" : "週二",
+ "Wednesday" : "週三",
+ "Thursday" : "週四",
+ "Friday" : "週五",
+ "Saturday" : "週六",
+ "Sun." : "日",
+ "Mon." : "一",
+ "Tue." : "二",
+ "Wed." : "三",
+ "Thu." : "四",
+ "Fri." : "五",
+ "Sat." : "六",
+ "Su" : "日",
+ "Mo" : "一",
+ "Tu" : "二",
+ "We" : "三",
+ "Th" : "四",
+ "Fr" : "五",
+ "Sa" : "六",
+ "January" : "一月",
+ "February" : "二月",
+ "March" : "三月",
+ "April" : "四月",
+ "May" : "五月",
+ "June" : "六月",
+ "July" : "七月",
+ "August" : "八月",
+ "September" : "九月",
+ "October" : "十月",
+ "November" : "十一月",
+ "December" : "十二月",
+ "Jan." : "一月",
+ "Feb." : "二月",
+ "Mar." : "三月",
+ "Apr." : "四月",
+ "May." : "五月",
+ "Jun." : "六月",
+ "Jul." : "七月",
+ "Aug." : "八月",
+ "Sep." : "九月",
+ "Oct." : "十月",
+ "Nov." : "十一月",
+ "Dec." : "十二月",
"Apps" : "應用程式",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "使用者名稱當中只能包含下列字元:\"a-z\", \"A-Z\", \"0-9\", 和 \"_.@-'\"",
"A valid username must be provided" : "必須提供一個有效的用戶名",
diff --git a/lib/l10n/zh_TW.json b/lib/l10n/zh_TW.json
index 1356943df67..df8f6bc5de4 100644
--- a/lib/l10n/zh_TW.json
+++ b/lib/l10n/zh_TW.json
@@ -98,6 +98,51 @@
"Expiration date is in the past" : "到期日是之前的時間",
"Cannot set expiration date more than %s days in the future" : "無法設定到期日超過未來%s天",
"Could not find category \"%s\"" : "找不到分類:\"%s\"",
+ "Sunday" : "週日",
+ "Monday" : "週一",
+ "Tuesday" : "週二",
+ "Wednesday" : "週三",
+ "Thursday" : "週四",
+ "Friday" : "週五",
+ "Saturday" : "週六",
+ "Sun." : "日",
+ "Mon." : "一",
+ "Tue." : "二",
+ "Wed." : "三",
+ "Thu." : "四",
+ "Fri." : "五",
+ "Sat." : "六",
+ "Su" : "日",
+ "Mo" : "一",
+ "Tu" : "二",
+ "We" : "三",
+ "Th" : "四",
+ "Fr" : "五",
+ "Sa" : "六",
+ "January" : "一月",
+ "February" : "二月",
+ "March" : "三月",
+ "April" : "四月",
+ "May" : "五月",
+ "June" : "六月",
+ "July" : "七月",
+ "August" : "八月",
+ "September" : "九月",
+ "October" : "十月",
+ "November" : "十一月",
+ "December" : "十二月",
+ "Jan." : "一月",
+ "Feb." : "二月",
+ "Mar." : "三月",
+ "Apr." : "四月",
+ "May." : "五月",
+ "Jun." : "六月",
+ "Jul." : "七月",
+ "Aug." : "八月",
+ "Sep." : "九月",
+ "Oct." : "十月",
+ "Nov." : "十一月",
+ "Dec." : "十二月",
"Apps" : "應用程式",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "使用者名稱當中只能包含下列字元:\"a-z\", \"A-Z\", \"0-9\", 和 \"_.@-'\"",
"A valid username must be provided" : "必須提供一個有效的用戶名",
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index af26d30d8e9..4e13d70371b 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -215,11 +215,13 @@ class AllConfig implements \OCP\IConfig {
// TODO - FIXME
$this->fixDIInit();
- if (isset($this->userCache[$userId][$appName][$key])) {
- if ($this->userCache[$userId][$appName][$key] === (string)$value) {
- return;
- } else if ($preCondition !== null && $this->userCache[$userId][$appName][$key] !== (string)$preCondition) {
+ $prevValue = $this->getUserValue($userId, $appName, $key, null);
+
+ if ($prevValue !== null) {
+ if ($prevValue === (string)$value) {
return;
+ } else if ($preCondition !== null && $prevValue !== (string)$preCondition) {
+ throw new PreConditionNotMetException();
} else {
$qb = $this->connection->getQueryBuilder();
$qb->update('preferences')
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 55fd575e129..fca5c9b87ac 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -31,6 +31,7 @@
namespace OC\App;
+use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\App\ManagerEvent;
use OCP\IAppConfig;
@@ -266,6 +267,21 @@ class AppManager implements IAppManager {
}
/**
+ * Get the directory for the given app.
+ *
+ * @param string $appId
+ * @return string
+ * @throws AppPathNotFoundException if app folder can't be found
+ */
+ public function getAppPath($appId) {
+ $appPath = \OC_App::getAppPath($appId);
+ if($appPath === false) {
+ throw new AppPathNotFoundException('Could not find path for ' . $appId);
+ }
+ return $appPath;
+ }
+
+ /**
* Clear the cached list of apps when enabling/disabling an app
*/
public function clearAppsCache() {
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php
index faef2f73b33..127430ea6cb 100644
--- a/lib/private/Authentication/Token/DefaultToken.php
+++ b/lib/private/Authentication/Token/DefaultToken.php
@@ -87,6 +87,17 @@ class DefaultToken extends Entity implements IToken {
*/
protected $lastCheck;
+ /**
+ * @var string
+ */
+ protected $scope;
+
+ public function __construct() {
+ $this->addType('type', 'int');
+ $this->addType('lastActivity', 'int');
+ $this->addType('lastCheck', 'int');
+ }
+
public function getId() {
return $this->id;
}
@@ -119,6 +130,7 @@ class DefaultToken extends Entity implements IToken {
'name' => $this->name,
'lastActivity' => $this->lastActivity,
'type' => $this->type,
+ 'scope' => $this->getScopeAsArray()
];
}
@@ -140,4 +152,25 @@ class DefaultToken extends Entity implements IToken {
return parent::setLastCheck($time);
}
+ public function getScope() {
+ return parent::getScope();
+ }
+
+ public function getScopeAsArray() {
+ $scope = json_decode($this->getScope(), true);
+ if (!$scope) {
+ return [
+ 'filesystem'=> true
+ ];
+ }
+ return $scope;
+ }
+
+ public function setScope($scope) {
+ if (is_array($scope)) {
+ parent::setScope(json_encode($scope));
+ } else {
+ parent::setScope((string)$scope);
+ }
+ }
}
diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php
index 752974ff240..8848cd3ec56 100644
--- a/lib/private/Authentication/Token/DefaultTokenMapper.php
+++ b/lib/private/Authentication/Token/DefaultTokenMapper.php
@@ -72,10 +72,9 @@ class DefaultTokenMapper extends Mapper {
public function getToken($token) {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();
- $result = $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'remember', 'token', 'last_activity', 'last_check')
+ $result = $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'remember', 'token', 'last_activity', 'last_check', 'scope')
->from('authtoken')
- ->where($qb->expr()->eq('token', $qb->createParameter('token')))
- ->setParameter('token', $token)
+ ->where($qb->expr()->eq('token', $qb->createNamedParameter($token)))
->execute();
$data = $result->fetch();
@@ -83,6 +82,30 @@ class DefaultTokenMapper extends Mapper {
if ($data === false) {
throw new DoesNotExistException('token does not exist');
}
+;
+ return DefaultToken::fromRow($data);
+ }
+
+ /**
+ * Get the token for $id
+ *
+ * @param string $id
+ * @throws DoesNotExistException
+ * @return DefaultToken
+ */
+ public function getTokenById($id) {
+ /* @var $qb IQueryBuilder */
+ $qb = $this->db->getQueryBuilder();
+ $result = $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'token', 'last_activity', 'last_check', 'scope')
+ ->from('authtoken')
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
+ ->execute();
+
+ $data = $result->fetch();
+ $result->closeCursor();
+ if ($data === false) {
+ throw new DoesNotExistException('token does not exist');
+ };
return DefaultToken::fromRow($data);
}
@@ -98,7 +121,7 @@ class DefaultTokenMapper extends Mapper {
public function getTokenByUser(IUser $user) {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();
- $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'remember', 'token', 'last_activity', 'last_check')
+ $qb->select('id', 'uid', 'login_name', 'password', 'name', 'type', 'remember', 'token', 'last_activity', 'last_check', 'scope')
->from('authtoken')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
->setMaxResults(1000);
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php
index 87f434c684c..ec4cc10c269 100644
--- a/lib/private/Authentication/Token/DefaultTokenProvider.php
+++ b/lib/private/Authentication/Token/DefaultTokenProvider.php
@@ -145,7 +145,7 @@ class DefaultTokenProvider implements IProvider {
}
/**
- * Get a token by token id
+ * Get a token by token
*
* @param string $tokenId
* @throws InvalidTokenException
@@ -160,6 +160,21 @@ class DefaultTokenProvider implements IProvider {
}
/**
+ * Get a token by token id
+ *
+ * @param string $tokenId
+ * @throws InvalidTokenException
+ * @return DefaultToken
+ */
+ public function getTokenById($tokenId) {
+ try {
+ return $this->mapper->getTokenById($tokenId);
+ } catch (DoesNotExistException $ex) {
+ throw new InvalidTokenException();
+ }
+ }
+
+ /**
* @param string $oldSessionId
* @param string $sessionId
* @throws InvalidTokenException
@@ -237,10 +252,10 @@ class DefaultTokenProvider implements IProvider {
*/
public function invalidateOldTokens() {
$olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24);
- $this->logger->info('Invalidating session tokens older than ' . date('c', $olderThan));
+ $this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan));
$this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER);
$rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
- $this->logger->info('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold));
+ $this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold));
$this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER);
}
diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php
index ce14a5880c5..9f280263d76 100644
--- a/lib/private/Authentication/Token/IProvider.php
+++ b/lib/private/Authentication/Token/IProvider.php
@@ -50,7 +50,16 @@ interface IProvider {
* @throws InvalidTokenException
* @return IToken
*/
- public function getToken($tokenId) ;
+ public function getToken($tokenId);
+
+ /**
+ * Get a token by token id
+ *
+ * @param string $tokenId
+ * @throws InvalidTokenException
+ * @return DefaultToken
+ */
+ public function getTokenById($tokenId);
/**
* Duplicate an existing session token
diff --git a/lib/private/Authentication/Token/IToken.php b/lib/private/Authentication/Token/IToken.php
index 14811dd3201..49745b266c4 100644
--- a/lib/private/Authentication/Token/IToken.php
+++ b/lib/private/Authentication/Token/IToken.php
@@ -67,9 +67,30 @@ interface IToken extends JsonSerializable {
public function getLastCheck();
/**
- * Get the timestamp of the last password check
+ * Set the timestamp of the last password check
*
* @param int $time
*/
public function setLastCheck($time);
+
+ /**
+ * Get the authentication scope for this token
+ *
+ * @return string
+ */
+ public function getScope();
+
+ /**
+ * Get the authentication scope for this token
+ *
+ * @return array
+ */
+ public function getScopeAsArray();
+
+ /**
+ * Set the authentication scope for this token
+ *
+ * @param array $scope
+ */
+ public function setScope($scope);
}
diff --git a/lib/private/DB/QueryBuilder/QuoteHelper.php b/lib/private/DB/QueryBuilder/QuoteHelper.php
index 6d15cec5a05..041718bce5a 100644
--- a/lib/private/DB/QueryBuilder/QuoteHelper.php
+++ b/lib/private/DB/QueryBuilder/QuoteHelper.php
@@ -61,6 +61,11 @@ class QuoteHelper {
throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed');
}
+ $string = str_replace(' AS ', ' as ', $string);
+ if (substr_count($string, ' as ')) {
+ return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2)));
+ }
+
if (substr_count($string, '.')) {
list($alias, $columnName) = explode('.', $string, 2);
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 5083b99b862..3a3f51488e6 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -142,26 +142,38 @@ class Cache implements ICache {
}
return $data;
} else {
- //fix types
- $data['fileid'] = (int)$data['fileid'];
- $data['parent'] = (int)$data['parent'];
- $data['size'] = 0 + $data['size'];
- $data['mtime'] = (int)$data['mtime'];
- $data['storage_mtime'] = (int)$data['storage_mtime'];
- $data['encryptedVersion'] = (int)$data['encrypted'];
- $data['encrypted'] = (bool)$data['encrypted'];
- $data['storage'] = $this->storageId;
- $data['mimetype'] = $this->mimetypeLoader->getMimetypeById($data['mimetype']);
- $data['mimepart'] = $this->mimetypeLoader->getMimetypeById($data['mimepart']);
- if ($data['storage_mtime'] == 0) {
- $data['storage_mtime'] = $data['mtime'];
- }
- $data['permissions'] = (int)$data['permissions'];
- return new CacheEntry($data);
+ return self::cacheEntryFromData($data, $this->storageId, $this->mimetypeLoader);
}
}
/**
+ * Create a CacheEntry from database row
+ *
+ * @param array $data
+ * @param string $storageId
+ * @param IMimeTypeLoader $mimetypeLoader
+ * @return CacheEntry
+ */
+ public static function cacheEntryFromData($data, $storageId, IMimeTypeLoader $mimetypeLoader) {
+ //fix types
+ $data['fileid'] = (int)$data['fileid'];
+ $data['parent'] = (int)$data['parent'];
+ $data['size'] = 0 + $data['size'];
+ $data['mtime'] = (int)$data['mtime'];
+ $data['storage_mtime'] = (int)$data['storage_mtime'];
+ $data['encryptedVersion'] = (int)$data['encrypted'];
+ $data['encrypted'] = (bool)$data['encrypted'];
+ $data['storage'] = $storageId;
+ $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']);
+ $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']);
+ if ($data['storage_mtime'] == 0) {
+ $data['storage_mtime'] = $data['mtime'];
+ }
+ $data['permissions'] = (int)$data['permissions'];
+ return new CacheEntry($data);
+ }
+
+ /**
* get the metadata of all files stored in $folder
*
* @param string $folder
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index 1196c6b0760..d8bdca6a3c4 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -27,6 +27,7 @@
namespace OC\Files\Cache\Wrapper;
use OC\Files\Cache\Cache;
+use OCP\Files\Cache\ICacheEntry;
/**
* Jail to a subdirectory of the wrapped cache
@@ -73,7 +74,7 @@ class CacheJail extends CacheWrapper {
}
/**
- * @param array $entry
+ * @param ICacheEntry|array $entry
* @return array
*/
protected function formatCacheEntry($entry) {
@@ -111,7 +112,7 @@ class CacheJail extends CacheWrapper {
* @throws \RuntimeException
*/
public function insert($file, array $data) {
- return $this->cache->insert($this->getSourcePath($file), $data);
+ return $this->getCache()->insert($this->getSourcePath($file), $data);
}
/**
@@ -121,7 +122,7 @@ class CacheJail extends CacheWrapper {
* @param array $data
*/
public function update($id, array $data) {
- $this->cache->update($id, $data);
+ $this->getCache()->update($id, $data);
}
/**
@@ -131,7 +132,7 @@ class CacheJail extends CacheWrapper {
* @return int
*/
public function getId($file) {
- return $this->cache->getId($this->getSourcePath($file));
+ return $this->getCache()->getId($this->getSourcePath($file));
}
/**
@@ -144,7 +145,7 @@ class CacheJail extends CacheWrapper {
if ($file === '') {
return -1;
} else {
- return $this->cache->getParentId($this->getSourcePath($file));
+ return $this->getCache()->getParentId($this->getSourcePath($file));
}
}
@@ -155,7 +156,7 @@ class CacheJail extends CacheWrapper {
* @return bool
*/
public function inCache($file) {
- return $this->cache->inCache($this->getSourcePath($file));
+ return $this->getCache()->inCache($this->getSourcePath($file));
}
/**
@@ -164,7 +165,7 @@ class CacheJail extends CacheWrapper {
* @param string $file
*/
public function remove($file) {
- $this->cache->remove($this->getSourcePath($file));
+ $this->getCache()->remove($this->getSourcePath($file));
}
/**
@@ -174,14 +175,14 @@ class CacheJail extends CacheWrapper {
* @param string $target
*/
public function move($source, $target) {
- $this->cache->move($this->getSourcePath($source), $this->getSourcePath($target));
+ $this->getCache()->move($this->getSourcePath($source), $this->getSourcePath($target));
}
/**
* remove all entries for files that are stored on the storage from the cache
*/
public function clear() {
- $this->cache->remove($this->root);
+ $this->getCache()->remove($this->root);
}
/**
@@ -190,7 +191,7 @@ class CacheJail extends CacheWrapper {
* @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
*/
public function getStatus($file) {
- return $this->cache->getStatus($this->getSourcePath($file));
+ return $this->getCache()->getStatus($this->getSourcePath($file));
}
private function formatSearchResults($results) {
@@ -206,7 +207,7 @@ class CacheJail extends CacheWrapper {
* @return array an array of file data
*/
public function search($pattern) {
- $results = $this->cache->search($pattern);
+ $results = $this->getCache()->search($pattern);
return $this->formatSearchResults($results);
}
@@ -217,7 +218,7 @@ class CacheJail extends CacheWrapper {
* @return array
*/
public function searchByMime($mimetype) {
- $results = $this->cache->searchByMime($mimetype);
+ $results = $this->getCache()->searchByMime($mimetype);
return $this->formatSearchResults($results);
}
@@ -229,7 +230,7 @@ class CacheJail extends CacheWrapper {
* @return array
*/
public function searchByTag($tag, $userId) {
- $results = $this->cache->searchByTag($tag, $userId);
+ $results = $this->getCache()->searchByTag($tag, $userId);
return $this->formatSearchResults($results);
}
@@ -240,8 +241,8 @@ class CacheJail extends CacheWrapper {
* @param array $data (optional) meta data of the folder
*/
public function correctFolderSize($path, $data = null) {
- if ($this->cache instanceof Cache) {
- $this->cache->correctFolderSize($this->getSourcePath($path), $data);
+ if ($this->getCache() instanceof Cache) {
+ $this->getCache()->correctFolderSize($this->getSourcePath($path), $data);
}
}
@@ -253,8 +254,8 @@ class CacheJail extends CacheWrapper {
* @return int
*/
public function calculateFolderSize($path, $entry = null) {
- if ($this->cache instanceof Cache) {
- return $this->cache->calculateFolderSize($this->getSourcePath($path), $entry);
+ if ($this->getCache() instanceof Cache) {
+ return $this->getCache()->calculateFolderSize($this->getSourcePath($path), $entry);
} else {
return 0;
}
@@ -292,7 +293,7 @@ class CacheJail extends CacheWrapper {
* @return string|null
*/
public function getPathById($id) {
- $path = $this->cache->getPathById($id);
+ $path = $this->getCache()->getPathById($id);
return $this->getJailedPath($path);
}
@@ -309,6 +310,6 @@ class CacheJail extends CacheWrapper {
if ($sourceCache === $this) {
return $this->move($sourcePath, $targetPath);
}
- return $this->cache->moveFromCache($sourceCache, $sourcePath, $this->getSourcePath($targetPath));
+ return $this->getCache()->moveFromCache($sourceCache, $sourcePath, $this->getSourcePath($targetPath));
}
}
diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
index 7a8177566c7..83fe7e5f43e 100644
--- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php
+++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
@@ -45,6 +45,10 @@ class CacheWrapper extends Cache {
$this->cache = $cache;
}
+ protected function getCache() {
+ return $this->cache;
+ }
+
/**
* Make it easy for wrappers to modify every returned cache entry
*
@@ -62,7 +66,7 @@ class CacheWrapper extends Cache {
* @return ICacheEntry|false
*/
public function get($file) {
- $result = $this->cache->get($file);
+ $result = $this->getCache()->get($file);
if ($result) {
$result = $this->formatCacheEntry($result);
}
@@ -76,7 +80,7 @@ class CacheWrapper extends Cache {
* @return ICacheEntry[]
*/
public function getFolderContents($folder) {
- // can't do a simple $this->cache->.... call here since getFolderContentsById needs to be called on this
+ // can't do a simple $this->getCache()->.... call here since getFolderContentsById needs to be called on this
// and not the wrapped cache
$fileId = $this->getId($folder);
return $this->getFolderContentsById($fileId);
@@ -89,7 +93,7 @@ class CacheWrapper extends Cache {
* @return array
*/
public function getFolderContentsById($fileId) {
- $results = $this->cache->getFolderContentsById($fileId);
+ $results = $this->getCache()->getFolderContentsById($fileId);
return array_map(array($this, 'formatCacheEntry'), $results);
}
@@ -121,7 +125,7 @@ class CacheWrapper extends Cache {
* @throws \RuntimeException
*/
public function insert($file, array $data) {
- return $this->cache->insert($file, $data);
+ return $this->getCache()->insert($file, $data);
}
/**
@@ -131,7 +135,7 @@ class CacheWrapper extends Cache {
* @param array $data
*/
public function update($id, array $data) {
- $this->cache->update($id, $data);
+ $this->getCache()->update($id, $data);
}
/**
@@ -141,7 +145,7 @@ class CacheWrapper extends Cache {
* @return int
*/
public function getId($file) {
- return $this->cache->getId($file);
+ return $this->getCache()->getId($file);
}
/**
@@ -151,7 +155,7 @@ class CacheWrapper extends Cache {
* @return int
*/
public function getParentId($file) {
- return $this->cache->getParentId($file);
+ return $this->getCache()->getParentId($file);
}
/**
@@ -161,7 +165,7 @@ class CacheWrapper extends Cache {
* @return bool
*/
public function inCache($file) {
- return $this->cache->inCache($file);
+ return $this->getCache()->inCache($file);
}
/**
@@ -170,7 +174,7 @@ class CacheWrapper extends Cache {
* @param string $file
*/
public function remove($file) {
- $this->cache->remove($file);
+ $this->getCache()->remove($file);
}
/**
@@ -180,18 +184,18 @@ class CacheWrapper extends Cache {
* @param string $target
*/
public function move($source, $target) {
- $this->cache->move($source, $target);
+ $this->getCache()->move($source, $target);
}
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
- $this->cache->moveFromCache($sourceCache, $sourcePath, $targetPath);
+ $this->getCache()->moveFromCache($sourceCache, $sourcePath, $targetPath);
}
/**
* remove all entries for files that are stored on the storage from the cache
*/
public function clear() {
- $this->cache->clear();
+ $this->getCache()->clear();
}
/**
@@ -200,7 +204,7 @@ class CacheWrapper extends Cache {
* @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
*/
public function getStatus($file) {
- return $this->cache->getStatus($file);
+ return $this->getCache()->getStatus($file);
}
/**
@@ -210,7 +214,7 @@ class CacheWrapper extends Cache {
* @return ICacheEntry[] an array of file data
*/
public function search($pattern) {
- $results = $this->cache->search($pattern);
+ $results = $this->getCache()->search($pattern);
return array_map(array($this, 'formatCacheEntry'), $results);
}
@@ -221,7 +225,7 @@ class CacheWrapper extends Cache {
* @return ICacheEntry[]
*/
public function searchByMime($mimetype) {
- $results = $this->cache->searchByMime($mimetype);
+ $results = $this->getCache()->searchByMime($mimetype);
return array_map(array($this, 'formatCacheEntry'), $results);
}
@@ -233,7 +237,7 @@ class CacheWrapper extends Cache {
* @return ICacheEntry[] file data
*/
public function searchByTag($tag, $userId) {
- $results = $this->cache->searchByTag($tag, $userId);
+ $results = $this->getCache()->searchByTag($tag, $userId);
return array_map(array($this, 'formatCacheEntry'), $results);
}
@@ -244,8 +248,8 @@ class CacheWrapper extends Cache {
* @param array $data (optional) meta data of the folder
*/
public function correctFolderSize($path, $data = null) {
- if ($this->cache instanceof Cache) {
- $this->cache->correctFolderSize($path, $data);
+ if ($this->getCache() instanceof Cache) {
+ $this->getCache()->correctFolderSize($path, $data);
}
}
@@ -257,8 +261,8 @@ class CacheWrapper extends Cache {
* @return int
*/
public function calculateFolderSize($path, $entry = null) {
- if ($this->cache instanceof Cache) {
- return $this->cache->calculateFolderSize($path, $entry);
+ if ($this->getCache() instanceof Cache) {
+ return $this->getCache()->calculateFolderSize($path, $entry);
} else {
return 0;
}
@@ -270,7 +274,7 @@ class CacheWrapper extends Cache {
* @return int[]
*/
public function getAll() {
- return $this->cache->getAll();
+ return $this->getCache()->getAll();
}
/**
@@ -283,7 +287,7 @@ class CacheWrapper extends Cache {
* @return string|bool the path of the folder or false when no folder matched
*/
public function getIncomplete() {
- return $this->cache->getIncomplete();
+ return $this->getCache()->getIncomplete();
}
/**
@@ -293,7 +297,7 @@ class CacheWrapper extends Cache {
* @return string|null
*/
public function getPathById($id) {
- return $this->cache->getPathById($id);
+ return $this->getCache()->getPathById($id);
}
/**
@@ -302,7 +306,7 @@ class CacheWrapper extends Cache {
* @return int
*/
public function getNumericStorageId() {
- return $this->cache->getNumericStorageId();
+ return $this->getCache()->getNumericStorageId();
}
/**
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index 55cf38bbdc9..51e494c372e 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -62,6 +62,7 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Config\MountProviderCollection;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
+use OC\Lockdown\Filesystem\NullStorage;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
@@ -213,10 +214,13 @@ class Filesystem {
/**
* @param bool $shouldLog
+ * @return bool previous value
* @internal
*/
public static function logWarningWhenAddingStorageWrapper($shouldLog) {
+ $previousValue = self::$logWarningWhenAddingStorageWrapper;
self::$logWarningWhenAddingStorageWrapper = (bool) $shouldLog;
+ return $previousValue;
}
/**
@@ -225,7 +229,7 @@ class Filesystem {
* @param int $priority
*/
public static function addStorageWrapper($wrapperName, $wrapper, $priority = 50) {
- if (self::$logWarningWhenAddingStorageWrapper && $wrapperName !== 'readonly') {
+ if (self::$logWarningWhenAddingStorageWrapper) {
\OC::$server->getLogger()->warning("Storage wrapper '{wrapper}' was not registered via the 'OC_Filesystem - preSetup' hook which could cause potential problems.", [
'wrapper' => $wrapperName,
'app' => 'filesystem',
@@ -426,25 +430,36 @@ class Filesystem {
self::$usersSetup[$user] = true;
}
- /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
- $mountConfigManager = \OC::$server->getMountProviderCollection();
+ if (\OC::$server->getLockdownManager()->canAccessFilesystem()) {
+ /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
+ $mountConfigManager = \OC::$server->getMountProviderCollection();
- // home mounts are handled seperate since we need to ensure this is mounted before we call the other mount providers
- $homeMount = $mountConfigManager->getHomeMountForUser($userObject);
+ // home mounts are handled seperate since we need to ensure this is mounted before we call the other mount providers
+ $homeMount = $mountConfigManager->getHomeMountForUser($userObject);
- self::getMountManager()->addMount($homeMount);
+ self::getMountManager()->addMount($homeMount);
- \OC\Files\Filesystem::getStorage($user);
+ \OC\Files\Filesystem::getStorage($user);
- // Chance to mount for other storages
- if ($userObject) {
- $mounts = $mountConfigManager->getMountsForUser($userObject);
- array_walk($mounts, array(self::$mounts, 'addMount'));
- $mounts[] = $homeMount;
- $mountConfigManager->registerMounts($userObject, $mounts);
- }
+ // Chance to mount for other storages
+ if ($userObject) {
+ $mounts = $mountConfigManager->getMountsForUser($userObject);
+ array_walk($mounts, array(self::$mounts, 'addMount'));
+ $mounts[] = $homeMount;
+ $mountConfigManager->registerMounts($userObject, $mounts);
+ }
- self::listenForNewMountProviders($mountConfigManager, $userManager);
+ self::listenForNewMountProviders($mountConfigManager, $userManager);
+ } else {
+ self::getMountManager()->addMount(new MountPoint(
+ new NullStorage([]),
+ '/' . $user
+ ));
+ self::getMountManager()->addMount(new MountPoint(
+ new NullStorage([]),
+ '/' . $user . '/files'
+ ));
+ }
\OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user));
}
diff --git a/lib/private/Lockdown/Filesystem/NullCache.php b/lib/private/Lockdown/Filesystem/NullCache.php
new file mode 100644
index 00000000000..8c6b5258aa8
--- /dev/null
+++ b/lib/private/Lockdown/Filesystem/NullCache.php
@@ -0,0 +1,122 @@
+<?php
+
+/**
+ * @copyright Copyright (c) 2016, Robin Appelman <robin@icewind.nl>
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\Lockdown\Filesystem;
+
+use OC\Files\Cache\CacheEntry;
+use OCP\Constants;
+use OCP\Files\Cache\ICache;
+use OCP\Files\Cache\ICacheEntry;
+use OCP\Files\FileInfo;
+
+class NullCache implements ICache {
+ public function getNumericStorageId() {
+ return -1;
+ }
+
+ public function get($file) {
+ return $file !== '' ? null :
+ new CacheEntry([
+ 'fileid' => -1,
+ 'parent' => -1,
+ 'name' => '',
+ 'path' => '',
+ 'size' => '0',
+ 'mtime' => time(),
+ 'storage_mtime' => time(),
+ 'etag' => '',
+ 'mimetype' => FileInfo::MIMETYPE_FOLDER,
+ 'mimepart' => 'httpd',
+ 'permissions' => Constants::PERMISSION_READ
+ ]);
+ }
+
+ public function getFolderContents($folder) {
+ return [];
+ }
+
+ public function getFolderContentsById($fileId) {
+ return [];
+ }
+
+ public function put($file, array $data) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function insert($file, array $data) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function update($id, array $data) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function getId($file) {
+ return -1;
+ }
+
+ public function getParentId($file) {
+ return -1;
+ }
+
+ public function inCache($file) {
+ return $file === '';
+ }
+
+ public function remove($file) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function move($source, $target) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function getStatus($file) {
+ return ICache::COMPLETE;
+ }
+
+ public function search($pattern) {
+ return [];
+ }
+
+ public function searchByMime($mimetype) {
+ return [];
+ }
+
+ public function searchByTag($tag, $userId) {
+ return [];
+ }
+
+ public function getIncomplete() {
+ return [];
+ }
+
+ public function getPathById($id) {
+ return '';
+ }
+
+ public function normalize($path) {
+ return $path;
+ }
+
+}
diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php
new file mode 100644
index 00000000000..967b6d2c6e7
--- /dev/null
+++ b/lib/private/Lockdown/Filesystem/NullStorage.php
@@ -0,0 +1,177 @@
+<?php
+
+/**
+ * @copyright Copyright (c) 2016, Robin Appelman <robin@icewind.nl>
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\Lockdown\Filesystem;
+
+use Icewind\Streams\IteratorDirectory;
+use OC\Files\Storage\Common;
+
+class NullStorage extends Common {
+ public function __construct($parameters) {
+ parent::__construct($parameters);
+ }
+
+ public function getId() {
+ return 'null';
+ }
+
+ public function mkdir($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function rmdir($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function opendir($path) {
+ return new IteratorDirectory([]);
+ }
+
+ public function is_dir($path) {
+ return $path === '';
+ }
+
+ public function is_file($path) {
+ return false;
+ }
+
+ public function stat($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function filetype($path) {
+ return ($path === '') ? 'dir' : false;
+ }
+
+ public function filesize($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function isCreatable($path) {
+ return false;
+ }
+
+ public function isReadable($path) {
+ return $path === '';
+ }
+
+ public function isUpdatable($path) {
+ return false;
+ }
+
+ public function isDeletable($path) {
+ return false;
+ }
+
+ public function isSharable($path) {
+ return false;
+ }
+
+ public function getPermissions($path) {
+ return null;
+ }
+
+ public function file_exists($path) {
+ return $path === '';
+ }
+
+ public function filemtime($path) {
+ return ($path === '') ? time() : false;
+ }
+
+ public function file_get_contents($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function file_put_contents($path, $data) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function unlink($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function rename($path1, $path2) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function copy($path1, $path2) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function fopen($path, $mode) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function getMimeType($path) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function hash($type, $path, $raw = false) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function free_space($path) {
+ return 0;
+ }
+
+ public function touch($path, $mtime = null) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function getLocalFile($path) {
+ return false;
+ }
+
+ public function hasUpdated($path, $time) {
+ return false;
+ }
+
+ public function getETag($path) {
+ return '';
+ }
+
+ public function isLocal() {
+ return false;
+ }
+
+ public function getDirectDownload($path) {
+ return false;
+ }
+
+ public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
+ }
+
+ public function test() {
+ return true;
+ }
+
+ public function getOwner($path) {
+ return null;
+ }
+
+ public function getCache($path = '', $storage = null) {
+ return new NullCache();
+ }
+}
diff --git a/lib/private/Lockdown/LockdownManager.php b/lib/private/Lockdown/LockdownManager.php
new file mode 100644
index 00000000000..5ce52a03683
--- /dev/null
+++ b/lib/private/Lockdown/LockdownManager.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @copyright Copyright (c) 2016, Robin Appelman <robin@icewind.nl>
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\Lockdown;
+
+use OC\Authentication\Token\IToken;
+use OCP\Lockdown\ILockdownManager;
+
+class LockdownManager implements ILockdownManager {
+ private $enabled = false;
+
+ /** @var array|null */
+ private $scope;
+
+ public function enable() {
+ $this->enabled = true;
+ }
+
+ public function setToken(IToken $token) {
+ $this->scope = $token->getScopeAsArray();
+ $this->enable();
+ }
+
+ public function canAccessFilesystem() {
+ if (!$this->enabled) {
+ return true;
+ }
+ return !$this->scope || $this->scope['filesystem'];
+ }
+}
diff --git a/lib/private/OCS/Person.php b/lib/private/OCS/Person.php
deleted file mode 100644
index d14465c5ce9..00000000000
--- a/lib/private/OCS/Person.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Tom Needham <tom@owncloud.com>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace OC\OCS;
-
-class Person {
-
- public static function check() {
- $login = isset($_POST['login']) ? $_POST['login'] : false;
- $password = isset($_POST['password']) ? $_POST['password'] : false;
- if($login && $password) {
- $remoteIp = \OC::$server->getRequest()->getRemoteAddress();
- \OC::$server->getBruteForceThrottler()->sleepDelay($remoteIp);
- if(\OC_User::checkPassword($login, $password)) {
- $xml['person']['personid'] = $login;
- return new Result($xml);
- } else {
- \OC::$server->getBruteForceThrottler()->registerAttempt('login', $remoteIp);
- return new Result(null, 102);
- }
- } else {
- return new Result(null, 101);
- }
- }
-
-}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index abedf8230ed..c6755357a1d 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -69,6 +69,7 @@ use OC\IntegrityCheck\Helpers\FileAccessHelper;
use OC\Lock\DBLockingProvider;
use OC\Lock\MemcacheLockingProvider;
use OC\Lock\NoopLockingProvider;
+use OC\Lockdown\LockdownManager;
use OC\Mail\Mailer;
use OC\Memcache\ArrayCache;
use OC\Notification\Manager;
@@ -795,6 +796,9 @@ class Server extends ServerContainer implements IServerContainer {
$c->getSystemConfig()
);
});
+ $this->registerService('LockdownManager', function (Server $c) {
+ return new LockdownManager();
+ });
}
/**
@@ -1534,4 +1538,11 @@ class Server extends ServerContainer implements IServerContainer {
$factory = $this->query(\OC\Files\AppData\Factory::class);
return $factory->get($app);
}
+
+ /**
+ * @return \OCP\Lockdown\ILockdownManager
+ */
+ public function getLockdownManager() {
+ return $this->query('LockdownManager');
+ }
}
diff --git a/lib/private/Settings/Admin/ServerDevNotice.php b/lib/private/Settings/Admin/ServerDevNotice.php
new file mode 100644
index 00000000000..1d7f34f782d
--- /dev/null
+++ b/lib/private/Settings/Admin/ServerDevNotice.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @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\Settings\Admin;
+
+use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Platforms\SqlitePlatform;
+use OC\Lock\DBLockingProvider;
+use OC\Lock\NoopLockingProvider;
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\IL10N;
+use OCP\Lock\ILockingProvider;
+use OCP\Settings\ISettings;
+
+class ServerDevNotice implements ISettings {
+ /**
+ * @return TemplateResponse
+ */
+ public function getForm() {
+ return new TemplateResponse('settings', 'admin/server.development.notice');
+ }
+
+ /**
+ * @return string the section ID, e.g. 'sharing'
+ */
+ public function getSection() {
+ return 'server';
+ }
+
+ /**
+ * @return int whether the form should be rather on the top or bottom of
+ * the admin section. The forms are arranged in ascending order of the
+ * priority values. It is required to return a value between 0 and 100.
+ *
+ * E.g.: 70
+ */
+ public function getPriority() {
+ return 1000;
+ }
+}
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index e7be3d4e77d..a6f9aacccb2 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -369,6 +369,8 @@ class Manager implements IManager {
/** @var ISettings $form */
$form = new Admin\Server($this->dbc, $this->config, $this->lockingProvider, $this->l);
$forms[$form->getPriority()] = [$form];
+ $form = new Admin\ServerDevNotice();
+ $forms[$form->getPriority()] = [$form];
}
if($section === 'encryption') {
/** @var ISettings $form */
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index bdb6ac466ec..7a602950171 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -23,6 +23,8 @@
*/
namespace OC\Share20;
+use OC\Files\Cache\Cache;
+use OC\Files\Cache\CacheEntry;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Share\IShareProvider;
@@ -571,7 +573,7 @@ class DefaultShareProvider implements IShareProvider {
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
));
-
+
$cursor = $qb->execute();
$data = $cursor->fetch();
$cursor->closeCursor();
@@ -656,7 +658,11 @@ class DefaultShareProvider implements IShareProvider {
if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
//Get shares directly with this user
$qb = $this->dbConn->getQueryBuilder();
- $qb->select('s.*', 'f.fileid', 'f.path')
+ $qb->select('s.*',
+ 'f.fileid', 'f.path', 'f.permissions AS f_permissions', 'f.storage', 'f.path_hash',
+ 'f.parent AS f_parent', 'f.name', 'f.mimetype', 'f.mimepart', 'f.size', 'f.mtime', 'f.storage_mtime',
+ 'f.encrypted', 'f.unencrypted_size', 'f.etag', 'f.checksum'
+ )
->selectAlias('st.id', 'storage_string_id')
->from('share', 's')
->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
@@ -709,7 +715,11 @@ class DefaultShareProvider implements IShareProvider {
}
$qb = $this->dbConn->getQueryBuilder();
- $qb->select('s.*', 'f.fileid', 'f.path')
+ $qb->select('s.*',
+ 'f.fileid', 'f.path', 'f.permissions AS f_permissions', 'f.storage', 'f.path_hash',
+ 'f.parent AS f_parent', 'f.name', 'f.mimetype', 'f.mimepart', 'f.size', 'f.mtime', 'f.storage_mtime',
+ 'f.encrypted', 'f.unencrypted_size', 'f.etag', 'f.checksum'
+ )
->selectAlias('st.id', 'storage_string_id')
->from('share', 's')
->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
@@ -798,7 +808,7 @@ class DefaultShareProvider implements IShareProvider {
return $share;
}
-
+
/**
* Create a share object from an database row
*
@@ -838,6 +848,15 @@ class DefaultShareProvider implements IShareProvider {
$share->setExpirationDate($expiration);
}
+ if (isset($data['f_permissions'])) {
+ $entryData = $data;
+ $entryData['permissions'] = $entryData['f_permissions'];
+ $entryData['parent'] = $entryData['f_parent'];;
+ $share->setNodeCacheEntry(Cache::cacheEntryFromData($entryData,
+ $entryData['storage_string_id'],
+ \OC::$server->getMimeTypeLoader()));
+ }
+
$share->setProviderId($this->identifier());
return $share;
diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php
index e3e8482f4e1..2e7e6d0ca2e 100644
--- a/lib/private/Share20/Share.php
+++ b/lib/private/Share20/Share.php
@@ -22,6 +22,7 @@
*/
namespace OC\Share20;
+use OCP\Files\Cache\ICacheEntry;
use OCP\Files\File;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
@@ -72,6 +73,9 @@ class Share implements \OCP\Share\IShare {
/** @var IUserManager */
private $userManager;
+ /** @var ICacheEntry|null */
+ private $nodeCacheEntry;
+
public function __construct(IRootFolder $rootFolder, IUserManager $userManager) {
$this->rootFolder = $rootFolder;
$this->userManager = $userManager;
@@ -418,4 +422,18 @@ class Share implements \OCP\Share\IShare {
public function getMailSend() {
return $this->mailSend;
}
+
+ /**
+ * @inheritdoc
+ */
+ public function setNodeCacheEntry(ICacheEntry $entry) {
+ $this->nodeCacheEntry = $entry;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getNodeCacheEntry() {
+ return $this->nodeCacheEntry;
+ }
}
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index ef408aa4077..a45b1dcd10f 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -525,10 +525,11 @@ class Session implements IUserSession, Emitter {
//login
$this->setUser($user);
$this->setLoginName($dbToken->getLoginName());
+ \OC::$server->getLockdownManager()->setToken($dbToken);
$this->manager->emit('\OC\User', 'postLogin', array($user, $password));
if ($this->isLoggedIn()) {
- $this->prepareUserLogin();
+ $this->prepareUserLogin(false); // token login cant be the first
} else {
// injecting l10n does not work - there is a circular dependency between session and \OCP\L10N\IFactory
$message = \OC::$server->getL10N('lib')->t('Login canceled by app');
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index c2ff9a5be3c..0d9adfa9d2b 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -376,6 +376,8 @@ class OC_App {
$config,
$l
);
+ $appPath = self::getAppPath($appId);
+ self::registerAutoloading($appId, $appPath);
$installer->installApp($appId);
} else {
// check for required dependencies
diff --git a/lib/public/App/AppPathNotFoundException.php b/lib/public/App/AppPathNotFoundException.php
new file mode 100644
index 00000000000..071eb2f8377
--- /dev/null
+++ b/lib/public/App/AppPathNotFoundException.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\App;
+
+/**
+ * Class AppPathNotFoundException
+ *
+ * @package OCP\App
+ * @since 11.0.0
+ */
+class AppPathNotFoundException extends \Exception {} \ No newline at end of file
diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php
index 44990b7c47c..057a964ce0a 100644
--- a/lib/public/App/IAppManager.php
+++ b/lib/public/App/IAppManager.php
@@ -79,6 +79,16 @@ interface IAppManager {
public function disableApp($appId);
/**
+ * Get the directory for the given app.
+ *
+ * @param string $appId
+ * @return string
+ * @since 11.0.0
+ * @throws AppPathNotFoundException
+ */
+ public function getAppPath($appId);
+
+ /**
* List all apps enabled for a user
*
* @param \OCP\IUser $user
diff --git a/lib/public/Lockdown/ILockdownManager.php b/lib/public/Lockdown/ILockdownManager.php
new file mode 100644
index 00000000000..d4d05b37ff8
--- /dev/null
+++ b/lib/public/Lockdown/ILockdownManager.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * @copyright Copyright (c) 2016, Robin Appelman <robin@icewind.nl>
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Lockdown;
+
+use OC\Authentication\Token\IToken;
+
+/**
+ * @since 9.2
+ */
+interface ILockdownManager {
+ /**
+ * Enable the lockdown restrictions
+ *
+ * @since 9.2
+ */
+ public function enable();
+
+ /**
+ * Set the active token to get the restrictions from and enable the lockdown
+ *
+ * @param IToken $token
+ * @since 9.2
+ */
+ public function setToken(IToken $token);
+
+ /**
+ * Check whether or not filesystem access is allowed
+ *
+ * @return bool
+ * @since 9.2
+ */
+ public function canAccessFilesystem();
+}
diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php
index 206b0e286a2..5b552b51c3c 100644
--- a/lib/public/Share/IShare.php
+++ b/lib/public/Share/IShare.php
@@ -22,6 +22,7 @@
namespace OCP\Share;
+use OCP\Files\Cache\ICacheEntry;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\Node;
@@ -324,4 +325,20 @@ interface IShare {
* @since 9.0.0
*/
public function getMailSend();
+
+ /**
+ * Set the cache entry for the shared node
+ *
+ * @param ICacheEntry $entry
+ * @since 11.0.0
+ */
+ public function setNodeCacheEntry(ICacheEntry $entry);
+
+ /**
+ * Get the cache entry for the shared node
+ *
+ * @return null|ICacheEntry
+ * @since 11.0.0
+ */
+ public function getNodeCacheEntry();
}