summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/appinfo/application.php4
-rw-r--r--apps/files_external/js/settings.js1
-rw-r--r--apps/files_external/l10n/sl.js2
-rw-r--r--apps/files_external/l10n/sl.json2
-rw-r--r--apps/files_external/lib/smb.php54
-rw-r--r--apps/files_external/personal.php1
-rw-r--r--apps/files_external/settings.php1
-rw-r--r--apps/files_external/templates/settings.php6
-rwxr-xr-xapps/files_external/tests/env/start-swift-ceph.sh5
-rw-r--r--apps/files_external/tests/js/settingsSpec.js6
10 files changed, 61 insertions, 21 deletions
diff --git a/apps/files_external/appinfo/application.php b/apps/files_external/appinfo/application.php
index 0f08cc6004f..cdc58aed7e8 100644
--- a/apps/files_external/appinfo/application.php
+++ b/apps/files_external/appinfo/application.php
@@ -59,9 +59,7 @@ class Application extends App {
$backendService = $container->query('OCA\\Files_External\\Service\\BackendService');
\OCP\App::registerAdmin('files_external', 'settings');
- if ($backendService->isUserMountingAllowed()) {
- \OCP\App::registerPersonal('files_external', 'personal');
- }
+ \OCP\App::registerPersonal('files_external', 'personal');
}
/**
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index ceacbf4afab..0b33458bec2 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -813,6 +813,7 @@ MountConfigListView.prototype = _.extend({
this.$el.find('tbody').append($tr.clone());
$tr.data('storageConfig', storageConfig);
+ $tr.show();
$tr.find('td').last().attr('class', 'remove');
$tr.find('td.mountOptionsToggle').removeClass('hidden');
$tr.find('td').last().removeAttr('style');
diff --git a/apps/files_external/l10n/sl.js b/apps/files_external/l10n/sl.js
index 819d38d6577..c3711b1e0ca 100644
--- a/apps/files_external/l10n/sl.js
+++ b/apps/files_external/l10n/sl.js
@@ -9,6 +9,7 @@ OC.L10N.register(
"Storage with id \"%i\" not found" : "Shrambe z ID \"%i\" ni mogoče najti.",
"Invalid mount point" : "Neveljavna priklopna točka",
"Invalid storage backend \"%s\"" : "Neveljaven ozadnji program shrambe \"%s\"",
+ "Unsatisfied authentication mechanism parameters" : "Nezadovoljivi parametri mehanizma overitve",
"Insufficient data: %s" : "Nepopolni podatki: %s",
"%s" : "%s",
"Personal" : "Osebno",
@@ -29,6 +30,7 @@ OC.L10N.register(
"(group)" : "(skupina)",
"Admin defined" : "Skrbnik je določen",
"Saved" : "Shranjeno",
+ "Couldn't get the list of external mount points: {type}" : "Ni mogoče pridobiti seznama zunanjih priklopnih točk: {type}",
"There was an error with message: " : "Prišlo je do napake s sporočilom:",
"External mount error" : "Notranja napaka priklopa",
"external-storage" : "zunanja-shramba",
diff --git a/apps/files_external/l10n/sl.json b/apps/files_external/l10n/sl.json
index c002757fb50..3f68c848ba4 100644
--- a/apps/files_external/l10n/sl.json
+++ b/apps/files_external/l10n/sl.json
@@ -7,6 +7,7 @@
"Storage with id \"%i\" not found" : "Shrambe z ID \"%i\" ni mogoče najti.",
"Invalid mount point" : "Neveljavna priklopna točka",
"Invalid storage backend \"%s\"" : "Neveljaven ozadnji program shrambe \"%s\"",
+ "Unsatisfied authentication mechanism parameters" : "Nezadovoljivi parametri mehanizma overitve",
"Insufficient data: %s" : "Nepopolni podatki: %s",
"%s" : "%s",
"Personal" : "Osebno",
@@ -27,6 +28,7 @@
"(group)" : "(skupina)",
"Admin defined" : "Skrbnik je določen",
"Saved" : "Shranjeno",
+ "Couldn't get the list of external mount points: {type}" : "Ni mogoče pridobiti seznama zunanjih priklopnih točk: {type}",
"There was an error with message: " : "Prišlo je do napake s sporočilom:",
"External mount error" : "Notranja napaka priklopa",
"external-storage" : "zunanja-shramba",
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 67d1a23f5a7..25acae95fa3 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -30,6 +30,7 @@
namespace OC\Files\Storage;
+use Icewind\SMB\Exception\ConnectException;
use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\ForbiddenException;
use Icewind\SMB\Exception\NotFoundException;
@@ -39,6 +40,7 @@ use Icewind\Streams\CallbackWrapper;
use Icewind\Streams\IteratorDirectory;
use OC\Cache\CappedMemoryCache;
use OC\Files\Filesystem;
+use OCP\Files\StorageNotAvailableException;
class SMB extends Common {
/**
@@ -104,26 +106,36 @@ class SMB extends Common {
/**
* @param string $path
* @return \Icewind\SMB\IFileInfo
+ * @throws StorageNotAvailableException
*/
protected function getFileInfo($path) {
- $path = $this->buildPath($path);
- if (!isset($this->statCache[$path])) {
- $this->statCache[$path] = $this->share->stat($path);
+ try {
+ $path = $this->buildPath($path);
+ if (!isset($this->statCache[$path])) {
+ $this->statCache[$path] = $this->share->stat($path);
+ }
+ return $this->statCache[$path];
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
- return $this->statCache[$path];
}
/**
* @param string $path
* @return \Icewind\SMB\IFileInfo[]
+ * @throws StorageNotAvailableException
*/
protected function getFolderContents($path) {
- $path = $this->buildPath($path);
- $files = $this->share->dir($path);
- foreach ($files as $file) {
- $this->statCache[$path . '/' . $file->getName()] = $file;
+ try {
+ $path = $this->buildPath($path);
+ $files = $this->share->dir($path);
+ foreach ($files as $file) {
+ $this->statCache[$path . '/' . $file->getName()] = $file;
+ }
+ return $files;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
- return $files;
}
/**
@@ -163,6 +175,8 @@ class SMB extends Common {
return false;
} catch (ForbiddenException $e) {
return false;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
@@ -245,6 +259,8 @@ class SMB extends Common {
return false;
} catch (ForbiddenException $e) {
return false;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
@@ -265,16 +281,22 @@ class SMB extends Common {
return false;
} catch (ForbiddenException $e) {
return false;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
public function touch($path, $time = null) {
- if (!$this->file_exists($path)) {
- $fh = $this->share->write($this->buildPath($path));
- fclose($fh);
- return true;
+ try {
+ if (!$this->file_exists($path)) {
+ $fh = $this->share->write($this->buildPath($path));
+ fclose($fh);
+ return true;
+ }
+ return false;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
- return false;
}
public function opendir($path) {
@@ -307,6 +329,8 @@ class SMB extends Common {
try {
$this->share->mkdir($path);
return true;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
} catch (Exception $e) {
return false;
}
@@ -320,6 +344,8 @@ class SMB extends Common {
return false;
} catch (ForbiddenException $e) {
return false;
+ } catch (ConnectException $e) {
+ throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php
index 4d8f480ecc0..5c568f45b7d 100644
--- a/apps/files_external/personal.php
+++ b/apps/files_external/personal.php
@@ -38,4 +38,5 @@ $tmpl->assign('storages', $userStoragesService->getStorages());
$tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends()));
$tmpl->assign('backends', $backendService->getAvailableBackends());
$tmpl->assign('authMechanisms', $backendService->getAuthMechanisms());
+$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed());
return $tmpl->fetchPage();
diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php
index 5bc330ff189..0d83d26ff97 100644
--- a/apps/files_external/settings.php
+++ b/apps/files_external/settings.php
@@ -44,5 +44,4 @@ $tmpl->assign('backends', $backendService->getAvailableBackends());
$tmpl->assign('authMechanisms', $backendService->getAuthMechanisms());
$tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends()));
$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed());
-$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed());
return $tmpl->fetchPage();
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index f7caf3d2caa..697a145131c 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -85,7 +85,11 @@
</tr>
</thead>
<tbody>
- <tr id="addMountPoint">
+ <tr id="addMountPoint"
+ <?php if ($_['visibilityType'] === BackendService::VISIBILITY_PERSONAL && $_['allowUserMounting'] === false): ?>
+ style="display: none;"
+ <?php endif; ?>
+ >
<td class="status">
<span></span>
</td>
diff --git a/apps/files_external/tests/env/start-swift-ceph.sh b/apps/files_external/tests/env/start-swift-ceph.sh
index 357512ae4d6..e884087c248 100755
--- a/apps/files_external/tests/env/start-swift-ceph.sh
+++ b/apps/files_external/tests/env/start-swift-ceph.sh
@@ -63,14 +63,15 @@ echo "${docker_image} container: $container"
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
echo $container >> $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
-echo -n "Waiting for ceph initialization"
+echo "Waiting for ceph initialization"
ready=$(timeout 600 cat "$notify_sock")
if [[ $ready != 'READY=1' ]]; then
echo "[ERROR] Waited 600 seconds, no response" >&2
docker logs $container
exit 1
fi
-sleep 1
+echo "Waiting another 15 seconds"
+sleep 15
cat > $thisFolder/config.swift.php <<DELIM
<?php
diff --git a/apps/files_external/tests/js/settingsSpec.js b/apps/files_external/tests/js/settingsSpec.js
index 2a7afd6c2fa..462407e9540 100644
--- a/apps/files_external/tests/js/settingsSpec.js
+++ b/apps/files_external/tests/js/settingsSpec.js
@@ -179,6 +179,12 @@ describe('OCA.External.Settings tests', function() {
// TODO: check "remove" button visibility
});
+ it('shows row even if selection row is hidden', function() {
+ view.$el.find('tr#addMountPoint').hide();
+ selectBackend('\\OC\\TestBackend');
+ expect(view.$el.find('tr:first').is(':visible')).toBe(true);
+ expect(view.$el.find('tr#addMountPoint').is(':visible')).toBe(false);
+ });
// TODO: test with personal mounts (no applicable fields)
// TODO: test suggested mount point logic
});