summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-05-17 13:14:57 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-05-17 13:14:57 +0200
commit23b8277c27ba116922513b5e0a4603de2f0cbf98 (patch)
treeb222ec652bc2199127924948ee62c6e79e6c6644
parent1d35c01b19ad70982c75cd76d0901485848cf8c4 (diff)
parent09631f691bd04baf1c31860f7b9c432c183e9400 (diff)
downloadnextcloud-server-23b8277c27ba116922513b5e0a4603de2f0cbf98.tar.gz
nextcloud-server-23b8277c27ba116922513b5e0a4603de2f0cbf98.zip
Merge pull request #15078 from owncloud/fix-smb-oc-admin-stable8
[stable8] Support constructing an SMB_OC without saved session credentials
-rw-r--r--apps/files_external/lib/smb_oc.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/files_external/lib/smb_oc.php b/apps/files_external/lib/smb_oc.php
index a7c93d97fd1..5e9442746f8 100644
--- a/apps/files_external/lib/smb_oc.php
+++ b/apps/files_external/lib/smb_oc.php
@@ -18,13 +18,19 @@ class SMB_OC extends \OC\Files\Storage\SMB {
* @throws \Exception
*/
public function __construct($params) {
- if (isset($params['host']) && \OC::$server->getSession()->exists('smb-credentials')) {
+ if (isset($params['host'])) {
$host=$params['host'];
$this->username_as_share = ($params['username_as_share'] === 'true');
- $params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$server->getSession()->get('smb-credentials')), true);
- $user = \OC::$server->getSession()->get('loginname');
- $password = $params_auth['password'];
+ $user = 'foo';
+ $password = 'bar';
+ if (\OC::$server->getSession()->exists('smb-credentials')) {
+ $params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$server->getSession()->get('smb-credentials')), true);
+ $user = \OC::$server->getSession()->get('loginname');
+ $password = $params_auth['password'];
+ } else {
+ // assume we are testing from the admin section
+ }
$root=isset($params['root'])?$params['root']:'/';
$share = '';