Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
e8f9b929
Commit
e8f9b929
authored
10 years ago
by
Vincent Petry
Browse files
Options
Downloads
Patches
Plain Diff
Added encryption test when moving file as non-owner
parent
f44e617d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_encryption/tests/share.php
+15
-2
15 additions, 2 deletions
apps/files_encryption/tests/share.php
with
15 additions
and
2 deletions
apps/files_encryption/tests/share.php
+
15
−
2
View file @
e8f9b929
...
@@ -1074,8 +1074,19 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
...
@@ -1074,8 +1074,19 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
\OC\Files\Filesystem
::
unlink
(
'/newfolder'
);
\OC\Files\Filesystem
::
unlink
(
'/newfolder'
);
}
}
function
testMoveFileToFolder
()
{
function
usersProvider
()
{
return
array
(
// test as owner
array
(
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER1
),
// test as share receiver
array
(
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER2
),
);
}
/**
* @dataProvider usersProvider
*/
function
testMoveFileToFolder
(
$userId
)
{
$view
=
new
\OC\Files\View
(
'/'
.
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER1
);
$view
=
new
\OC\Files\View
(
'/'
.
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER1
);
$filename
=
'/tmp-'
.
uniqid
();
$filename
=
'/tmp-'
.
uniqid
();
...
@@ -1108,8 +1119,10 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
...
@@ -1108,8 +1119,10 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase {
$this
->
assertTrue
(
$view
->
file_exists
(
'files_encryption/share-keys'
.
$folder
.
'/'
.
$filename
.
'.'
.
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER1
.
'.shareKey'
));
$this
->
assertTrue
(
$view
->
file_exists
(
'files_encryption/share-keys'
.
$folder
.
'/'
.
$filename
.
'.'
.
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER1
.
'.shareKey'
));
$this
->
assertTrue
(
$view
->
file_exists
(
'files_encryption/share-keys'
.
$folder
.
'/'
.
$filename
.
'.'
.
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER2
.
'.shareKey'
));
$this
->
assertTrue
(
$view
->
file_exists
(
'files_encryption/share-keys'
.
$folder
.
'/'
.
$filename
.
'.'
.
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER2
.
'.shareKey'
));
// move the file into the subfolder
// move the file into the subfolder as the test user
\Test_Encryption_Util
::
loginHelper
(
$userId
);
\OC\Files\Filesystem
::
rename
(
$folder
.
$filename
,
$subFolder
.
$filename
);
\OC\Files\Filesystem
::
rename
(
$folder
.
$filename
,
$subFolder
.
$filename
);
\Test_Encryption_Util
::
loginHelper
(
\Test_Encryption_Share
::
TEST_ENCRYPTION_SHARE_USER1
);
// Get file decrypted contents
// Get file decrypted contents
$newDecrypt
=
\OC\Files\Filesystem
::
file_get_contents
(
$subFolder
.
$filename
);
$newDecrypt
=
\OC\Files\Filesystem
::
file_get_contents
(
$subFolder
.
$filename
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment