Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
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
be6edd46
Commit
be6edd46
authored
Mar 19, 2015
by
Robin Appelman
Browse files
Merge pull request #14537 from owncloud/oci-external-share
Fix external shares without password on oracle
parents
0868e496
6a677ce8
Changes
3
Hide whitespace changes
Inline
Side-by-side
apps/files_sharing/lib/external/manager.php
View file @
be6edd46
...
...
@@ -321,4 +321,4 @@ class Manager {
return
$result
?
$openShares
->
fetchAll
()
:
array
();
}
}
\ No newline at end of file
}
apps/files_sharing/lib/external/storage.php
View file @
be6edd46
...
...
@@ -70,7 +70,7 @@ class Storage extends DAV implements ISharedStorage {
'host'
=>
$host
,
'root'
=>
$root
,
'user'
=>
$options
[
'token'
],
'password'
=>
$options
[
'password'
]
'password'
=>
(
string
)
$options
[
'password'
]
));
}
...
...
apps/files_sharing/tests/external/manager.php
0 → 100644
View file @
be6edd46
<?php
/**
* @author Robin Appelman <icewind@owncloud.com>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace
OCA\Files_sharing\Tests\External
;
use
OC\Files\Storage\StorageFactory
;
use
Test\TestCase
;
class
Manager
extends
TestCase
{
private
$uid
;
/**
* @var \OC\Files\Mount\Manager
*/
private
$mountManager
;
/**
* @var \OCA\Files_Sharing\External\Manager
*/
private
$instance
;
public
function
setUp
()
{
$this
->
uid
=
uniqid
();
$this
->
mountManager
=
new
\
OC\Files\Mount\Manager
();
$this
->
instance
=
new
\
OCA\Files_Sharing\External\Manager
(
\
OC
::
$server
->
getDatabaseConnection
(),
$this
->
mountManager
,
new
StorageFactory
(),
\
OC
::
$server
->
getHTTPHelper
(),
$this
->
uid
);
}
public
function
tearDown
()
{
$this
->
instance
->
removeUserShares
(
$this
->
uid
);
}
private
function
getFullPath
(
$path
)
{
return
'/'
.
$this
->
uid
.
'/files'
.
$path
;
}
private
function
assertMount
(
$mountPoint
)
{
$mountPoint
=
rtrim
(
$mountPoint
,
'/'
);
$mount
=
$this
->
mountManager
->
find
(
$this
->
getFullPath
(
$mountPoint
));
$this
->
assertInstanceOf
(
'\OCP\Files\Mount\IMountPoint'
,
$mount
);
$this
->
assertEquals
(
$this
->
getFullPath
(
$mountPoint
),
rtrim
(
$mount
->
getMountPoint
(),
'/'
));
$storage
=
$mount
->
getStorage
();
$this
->
assertInstanceOf
(
'\OCA\Files_Sharing\External\Storage'
,
$storage
);
}
private
function
assertNotMount
(
$mountPoint
)
{
$mountPoint
=
rtrim
(
$mountPoint
,
'/'
);
$mount
=
$this
->
mountManager
->
find
(
$this
->
getFullPath
(
$mountPoint
));
if
(
$mount
)
{
$this
->
assertInstanceOf
(
'\OCP\Files\Mount\IMountPoint'
,
$mount
);
$this
->
assertNotEquals
(
$this
->
getFullPath
(
$mountPoint
),
rtrim
(
$mount
->
getMountPoint
(),
'/'
));
}
else
{
$this
->
assertNull
(
$mount
);
}
}
public
function
testAddBasic
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
true
);
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/example'
);
}
public
function
testAddBasicEmptyPassword
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
''
,
'example'
,
'me'
,
true
);
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/example'
);
}
public
function
testAddNotAcceptedShare
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
false
);
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertNotMount
(
'/example'
);
}
public
function
testAcceptMount
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
false
);
$open
=
$this
->
instance
->
getOpenShares
();
$this
->
assertCount
(
1
,
$open
);
$this
->
instance
->
acceptShare
(
$open
[
0
][
'id'
]);
$this
->
assertEquals
([],
$this
->
instance
->
getOpenShares
());
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/example'
);
}
public
function
testDeclineMount
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
false
);
$open
=
$this
->
instance
->
getOpenShares
();
$this
->
assertCount
(
1
,
$open
);
$this
->
instance
->
declineShare
(
$open
[
0
][
'id'
]);
$this
->
assertEquals
([],
$this
->
instance
->
getOpenShares
());
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertNotMount
(
'/example'
);
}
public
function
testSetMountPoint
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
true
);
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/example'
);
$this
->
instance
->
setMountPoint
(
$this
->
getFullPath
(
'/example'
),
$this
->
getFullPath
(
'/renamed'
));
$this
->
mountManager
->
clear
();
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/renamed'
);
$this
->
assertNotMount
(
'/example'
);
}
public
function
testRemoveShare
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
true
);
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/example'
);
$this
->
instance
->
removeShare
(
$this
->
getFullPath
(
'/example'
));
$this
->
mountManager
->
clear
();
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertNotMount
(
'/example'
);
}
public
function
testRemoveShareForUser
()
{
$this
->
instance
->
addShare
(
'http://example.com'
,
'foo'
,
'bar'
,
'example'
,
'me'
,
true
);
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertMount
(
'/example'
);
$this
->
instance
->
removeUserShares
(
$this
->
uid
);
$this
->
mountManager
->
clear
();
\
Test_Helper
::
invokePrivate
(
$this
->
instance
,
'setupMounts'
);
$this
->
assertNotMount
(
'/example'
);
}
}
Write
Preview
Supports
Markdown
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