]> source.dussan.org Git - nextcloud-server.git/commitdiff
Support constructing an SMB_OC without saved session credentials
authorRobin McCorkell <rmccorkell@karoshi.org.uk>
Fri, 20 Mar 2015 15:55:53 +0000 (15:55 +0000)
committerRobin McCorkell <rmccorkell@karoshi.org.uk>
Fri, 20 Mar 2015 16:07:19 +0000 (16:07 +0000)
Conflicts:
apps/files_external/lib/smb_oc.php

apps/files_external/lib/smb_oc.php

index 8ead750d083574e08627ed625a3db6769ed9d53e..5dedfaaebb12c7ab40435bee64ea6edbc1684b8f 100644 (file)
@@ -18,13 +18,19 @@ class SMB_OC extends \OC\Files\Storage\SMB {
         * @throws \Exception
         */
        public function __construct($params) {
-               if (isset($params['host']) && \OC::$session->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::$session->get('smb-credentials')), true);
-                       $user = \OC::$session->get('loginname');
-                       $password = $params_auth['password'];
+                       $user = 'foo';
+                       $password = 'bar';
+                       if (\OC::$session->exists('smb-credentials')) {
+                               $params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$session->get('smb-credentials')), true);
+                               $user = \OC::$session->get('loginname');
+                               $password = $params_auth['password'];
+                       } else {
+                               // assume we are testing from the admin section
+                       }
 
                        $root=isset($params['root'])?$params['root']:'/';
                        $share = '';