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
8fb75f37
Commit
8fb75f37
authored
13 years ago
by
Michael Gapczynski
Browse files
Options
Downloads
Patches
Plain Diff
Comment rename() and prevent trying to move items if the user doesn't have write permission
parent
b4cf61ee
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_sharing/sharedstorage.php
+6
-0
6 additions, 0 deletions
apps/files_sharing/sharedstorage.php
with
6 additions
and
0 deletions
apps/files_sharing/sharedstorage.php
+
6
−
0
View file @
8fb75f37
...
...
@@ -423,8 +423,10 @@ class OC_Filestorage_Shared extends OC_Filestorage {
if
(
$folders
=
OC_Share
::
getParentFolders
(
$oldTarget
))
{
$root1
=
substr
(
$path1
,
0
,
strpos
(
$path1
,
"/"
));
$root2
=
substr
(
$path1
,
0
,
strpos
(
$path2
,
"/"
));
// Prevent items from being moved into different shared folders until versioning (cut and paste) and prevent items going into 'Shared'
if
(
$root1
!==
$root2
)
{
return
false
;
// Check if both paths have write permission
}
else
if
(
$this
->
is_writeable
(
$path1
)
&&
$this
->
is_writeable
(
$path2
))
{
$oldSource
=
$this
->
getSource
(
$path1
);
$newSource
=
$folders
[
'source'
]
.
substr
(
$newTarget
,
strlen
(
$folders
[
'target'
]));
...
...
@@ -432,6 +434,10 @@ class OC_Filestorage_Shared extends OC_Filestorage {
$storage
=
OC_Filesystem
::
getStorage
(
$oldSource
);
return
$storage
->
rename
(
$this
->
getInternalPath
(
$oldSource
),
$this
->
getInternalPath
(
$newSource
));
}
// If the user doesn't have write permission, items can only be renamed and not moved
}
else
if
(
dirname
(
$path1
)
!==
dirname
(
$path2
))
{
return
false
;
// The item will be renamed in the database, but won't be touched on the owner's filesystem
}
else
{
OC_Share
::
pullOutOfFolder
(
$oldTarget
,
$newTarget
);
// If this is a folder being renamed, call setTarget in case there are any database entries inside the folder
...
...
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