diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-05 10:05:23 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-05 10:05:23 +0100 |
commit | 342c2aac98961f91f0fd38423a217cb980dd95b8 (patch) | |
tree | ddb43c367f8b27fae912b27d06ce7d1a834ad182 /apps/files_external/lib | |
parent | c8e136b7dc2f51fa260d9eb67452c86f2317c79c (diff) | |
parent | d4da2f0ac717235e57db095cdf3e7f328996ba4c (diff) | |
download | nextcloud-server-342c2aac98961f91f0fd38423a217cb980dd95b8.tar.gz nextcloud-server-342c2aac98961f91f0fd38423a217cb980dd95b8.zip |
Merge pull request #20920 from owncloud/issue_20888
Add dialog to enter credentials on errored mount point
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/config/configadapter.php | 10 | ||||
-rw-r--r-- | apps/files_external/lib/failedcache.php | 3 | ||||
-rw-r--r-- | apps/files_external/lib/insufficientdataformeaningfulanswerexception.php | 11 | ||||
-rw-r--r-- | apps/files_external/lib/smb.php | 13 | ||||
-rw-r--r-- | apps/files_external/lib/storageconfig.php | 2 |
5 files changed, 38 insertions, 1 deletions
diff --git a/apps/files_external/lib/config/configadapter.php b/apps/files_external/lib/config/configadapter.php index 2bf39bcaa4f..51c2debd726 100644 --- a/apps/files_external/lib/config/configadapter.php +++ b/apps/files_external/lib/config/configadapter.php @@ -130,6 +130,16 @@ class ConfigAdapter implements IMountProvider { $impl = new FailedStorage(['exception' => $e]); } + try { + $availability = $impl->getAvailability(); + if (!$availability['available']) { + $impl = new FailedStorage(['exception' => null]); + } + } catch (\Exception $e) { + // propagate exception into filesystem + $impl = new FailedStorage(['exception' => $e]); + } + $mount = new MountPoint( $impl, '/' . $user->getUID() . '/files' . $storage->getMountPoint(), diff --git a/apps/files_external/lib/failedcache.php b/apps/files_external/lib/failedcache.php index f9866f43058..0f59495e595 100644 --- a/apps/files_external/lib/failedcache.php +++ b/apps/files_external/lib/failedcache.php @@ -22,6 +22,7 @@ namespace OCA\Files_External\Lib; use OC\Files\Cache\CacheEntry; +use OCP\Constants; use OCP\Files\Cache\ICache; /** @@ -40,7 +41,7 @@ class FailedCache implements ICache { 'size' => 0, 'mimetype' => 'httpd/unix-directory', 'mimepart' => 'httpd', - 'permissions' => 0, + 'permissions' => Constants::PERMISSION_READ, 'mtime' => time() ]); } else { diff --git a/apps/files_external/lib/insufficientdataformeaningfulanswerexception.php b/apps/files_external/lib/insufficientdataformeaningfulanswerexception.php index 871301b9b51..22d83ef56f4 100644 --- a/apps/files_external/lib/insufficientdataformeaningfulanswerexception.php +++ b/apps/files_external/lib/insufficientdataformeaningfulanswerexception.php @@ -27,4 +27,15 @@ use \OCP\Files\StorageNotAvailableException; * Authentication mechanism or backend has insufficient data */ class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableException { + /** + * StorageNotAvailableException constructor. + * + * @param string $message + * @param int $code + * @param \Exception $previous + * @since 6.0.0 + */ + public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { + parent::__construct($message, $code, $previous); + } } diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 9da21dc88e6..50bd56f28ad 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -314,4 +314,17 @@ class SMB extends Common { || Server::NativeAvailable() ) ? true : ['smbclient']; } + + /** + * Test a storage for availability + * + * @return bool + */ + public function test() { + try { + return parent::test(); + } catch (Exception $e) { + return false; + } + } } diff --git a/apps/files_external/lib/storageconfig.php b/apps/files_external/lib/storageconfig.php index 7f716893842..6f44b25a2e6 100644 --- a/apps/files_external/lib/storageconfig.php +++ b/apps/files_external/lib/storageconfig.php @@ -24,6 +24,7 @@ namespace OCA\Files_external\Lib; +use OCA\Files_External\Lib\Auth\IUserProvided; use \OCA\Files_External\Lib\Backend\Backend; use \OCA\Files_External\Lib\Auth\AuthMechanism; @@ -406,6 +407,7 @@ class StorageConfig implements \JsonSerializable { if (!is_null($this->statusMessage)) { $result['statusMessage'] = $this->statusMessage; } + $result['userProvided'] = $this->authMechanism instanceof IUserProvided; $result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAl) ? 'personal': 'system'; return $result; } |