Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
eb2587a0
Commit
eb2587a0
authored
11 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
move isSystemWideMountPoint() to util.php
parent
f2de4cb3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_encryption/lib/keymanager.php
+4
-19
4 additions, 19 deletions
apps/files_encryption/lib/keymanager.php
apps/files_encryption/lib/util.php
+15
-0
15 additions, 0 deletions
apps/files_encryption/lib/util.php
with
19 additions
and
19 deletions
apps/files_encryption/lib/keymanager.php
+
4
−
19
View file @
eb2587a0
...
...
@@ -127,7 +127,7 @@ class Keymanager {
list
(
$owner
,
$filename
)
=
$util
->
getUidAndFilename
(
$path
);
// in case of system wide mount points the keys are stored directly in the data directory
if
(
self
::
isSystemWideMountPoint
(
$filename
))
{
if
(
$util
->
isSystemWideMountPoint
(
$filename
))
{
$basePath
=
'/files_encryption/keyfiles'
;
}
else
{
$basePath
=
'/'
.
$owner
.
'/files_encryption/keyfiles'
;
...
...
@@ -239,7 +239,7 @@ class Keymanager {
$filePath_f
=
ltrim
(
$filename
,
'/'
);
// in case of system wide mount points the keys are stored directly in the data directory
if
(
self
::
isSystemWideMountPoint
(
$filename
))
{
if
(
$util
->
isSystemWideMountPoint
(
$filename
))
{
$keyfilePath
=
'/files_encryption/keyfiles/'
.
$filePath_f
.
'.key'
;
}
else
{
$keyfilePath
=
'/'
.
$owner
.
'/files_encryption/keyfiles/'
.
$filePath_f
.
'.key'
;
...
...
@@ -374,7 +374,7 @@ class Keymanager {
list
(
$owner
,
$filename
)
=
$util
->
getUidAndFilename
(
$path
);
// in case of system wide mount points the keys are stored directly in the data directory
if
(
self
::
isSystemWideMountPoint
(
$filename
))
{
if
(
$util
->
isSystemWideMountPoint
(
$filename
))
{
$basePath
=
'/files_encryption/share-keys'
;
}
else
{
$basePath
=
'/'
.
$owner
.
'/files_encryption/share-keys'
;
...
...
@@ -438,7 +438,7 @@ class Keymanager {
list
(
$owner
,
$filename
)
=
$util
->
getUidAndFilename
(
$filePath
);
// in case of system wide mount points the keys are stored directly in the data directory
if
(
self
::
isSystemWideMountPoint
(
$filename
))
{
if
(
$util
->
isSystemWideMountPoint
(
$filename
))
{
$shareKeyPath
=
'/files_encryption/share-keys/'
.
$filename
.
'.'
.
$userId
.
'.shareKey'
;
}
else
{
$shareKeyPath
=
'/'
.
$owner
.
'/files_encryption/share-keys/'
.
$filename
.
'.'
.
$userId
.
'.shareKey'
;
...
...
@@ -569,19 +569,4 @@ class Keymanager {
return
$targetPath
;
}
/**
* @brief check if the file is stored on a system wide mount point
* @param $path relative to /data/user with leading '/'
* @return boolean
*/
private
static
function
isSystemWideMountPoint
(
$path
)
{
$mount
=
\OC_Mount_Config
::
getSystemMountPoints
();
foreach
(
$mount
as
$mountPoint
=>
$data
)
{
if
(
$mountPoint
==
substr
(
$path
,
1
,
strlen
(
$mountPoint
)))
{
return
true
;
}
}
return
false
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
apps/files_encryption/lib/util.php
+
15
−
0
View file @
eb2587a0
...
...
@@ -1561,4 +1561,19 @@ class Util {
return
$relativePath
;
}
/**
* @brief check if the file is stored on a system wide mount point
* @param $path relative to /data/user with leading '/'
* @return boolean
*/
public
function
isSystemWideMountPoint
(
$path
)
{
$mount
=
\OC_Mount_Config
::
getSystemMountPoints
();
foreach
(
$mount
as
$mountPoint
=>
$data
)
{
if
(
$mountPoint
==
substr
(
$path
,
1
,
strlen
(
$mountPoint
)))
{
return
true
;
}
}
return
false
;
}
}
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