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
14b240a3
Commit
14b240a3
authored
13 years ago
by
Michael Gapczynski
Browse files
Options
Downloads
Patches
Plain Diff
Still trying to fix some sharing use cases
parent
a589a700
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_sharing/lib_share.php
+23
-7
23 additions, 7 deletions
apps/files_sharing/lib_share.php
apps/files_sharing/sharedstorage.php
+0
-3
0 additions, 3 deletions
apps/files_sharing/sharedstorage.php
with
23 additions
and
10 deletions
apps/files_sharing/lib_share.php
+
23
−
7
View file @
14b240a3
...
...
@@ -76,7 +76,7 @@ class OC_Share {
throw
new
Exception
(
"This item is already shared with "
.
$uid
);
}
// Check if the target already exists for the user, if it does append a number to the name
$sharedFolder
=
"/"
.
$uid
.
"
/files/Shared
"
;
$sharedFolder
=
'/'
.
$uid
.
'
/files/Shared
'
;
$target
=
$sharedFolder
.
"/"
.
basename
(
$source
);
if
(
self
::
getSource
(
$target
))
{
if
(
$pos
=
strrpos
(
$target
,
"."
))
{
...
...
@@ -98,8 +98,14 @@ class OC_Share {
$uid
=
$uid
.
"@"
.
$gid
;
}
$query
->
execute
(
array
(
$uid_owner
,
$uid
,
$source
,
$target
,
$permissions
));
// Update mtime of shared folder to invoke a file cache rescan
OC_Filesystem
::
getStorage
(
$sharedFolder
)
->
touch
(
$sharedFolder
);
// Emit post_write hook to invoke a file cache rescan
$storage
=
OC_Filesystem
::
getStorage
(
$sharedFolder
);
if
(
!
$storage
->
is_dir
(
$sharedFolder
))
{
$storage
->
mkdir
(
$sharedFolder
);
OCP\Util
::
emitHook
(
'OC_Filesystem'
,
'post_write'
,
array
(
'path'
=>
$sharedFolder
));
}
else
{
OCP\Util
::
emitHook
(
'OC_Filesystem'
,
'post_write'
,
array
(
'path'
=>
$target
));
}
}
}
}
...
...
@@ -374,12 +380,22 @@ class OC_Share {
*/
public
static
function
unshare
(
$source
,
$uid_shared_with
)
{
$source
=
self
::
cleanPath
(
$source
);
$uid_owner
=
OCP\USER
::
getUser
();
$query
=
OCP\DB
::
prepare
(
"DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with "
.
self
::
getUsersAndGroups
(
$uid_shared_with
));
$query
->
execute
(
array
(
strlen
(
$source
),
$source
,
OCP\USER
::
getUser
()));
// Update mtime of shared folder to invoke a file cache rescan
$query
->
execute
(
array
(
strlen
(
$source
),
$source
,
$uid_owner
));
if
(
$uid_shared_with
!=
self
::
PUBLICLINK
)
{
$sharedFolder
=
'/'
.
$uid_shared_with
.
'/files/Shared'
;
OC_Filesystem
::
getStorage
(
$sharedFolder
)
->
touch
(
$sharedFolder
);
if
(
OC_Group
::
groupExists
(
$uid_shared_with
))
{
$uid_shared_with
=
OC_Group
::
usersInGroup
(
$uid_shared_with
);
// Remove the owner from the list of users in the group
$uid_shared_with
=
array_diff
(
$uid_shared_with
,
array
(
$uid_owner
));
}
else
{
$uid_shared_with
=
array
(
$uid_shared_with
);
}
foreach
(
$uid_shared_with
as
$uid
)
{
$sharedFolder
=
'/'
.
$uid
.
'/files/'
.
'Shared'
;
// Emit post_write hook to invoke a file cache rescan
OCP\Util
::
emitHook
(
'OC_Filesystem'
,
'post_write'
,
array
(
'path'
=>
$sharedFolder
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
apps/files_sharing/sharedstorage.php
+
0
−
3
View file @
14b240a3
...
...
@@ -22,9 +22,6 @@
require_once
(
'lib_share.php'
);
if
(
OC_Filesystem
::
$loaded
and
!
OC_Filesystem
::
is_dir
(
'/Shared'
))
{
OC_Filesystem
::
mkdir
(
'/Shared'
);
}
OC_Filesystem
::
mount
(
'OC_Filestorage_Shared'
,
array
(
'datadir'
=>
'/'
.
OCP\USER
::
getUser
()
.
'/files/Shared'
),
'/'
.
OCP\USER
::
getUser
()
.
'/files/Shared/'
);
/**
...
...
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