Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
1f3fdf17
Commit
1f3fdf17
authored
Mar 20, 2015
by
Robin McCorkell
Browse files
Support constructing an SMB_OC without saved session credentials
parent
a45e45df
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/files_external/lib/smb_oc.php
View file @
1f3fdf17
...
...
@@ -21,13 +21,20 @@ class SMB_OC extends 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'
];
// dummy credentials, unused, to satisfy constructor
$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
=
''
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment