Skip to content

Quota storage wrapper is now used for all users in sharing mode - #5715

Merged
PVince81 merged 2 commits into
masterfrom
quota-sharing-wrapotherusershome
Nov 21, 2013
Merged

PVince81 merged 2 commits into
masterfrom
quota-sharing-wrapotherusershome

Conversation

@PVince81

@PVince81 PVince81 commented Nov 6, 2013

Copy link
Copy Markdown
Contributor

When accessing a shared folder, the folder's owner appears as mountpoint
but wasn't wrapped by a quota storage wrapper.

This fix makes sure that all home storages are wrapped by a quota
storage wrapper, if applicable, to make sure quotas are respected when
uploading into shared folders.

@icewind1991 are "local://" based home dirs migrated to "home://" storages or should I add extra handling for those ?

Please review @icewind1991 @DeepDiver1975 @karlitschek

I'll add unit tests soon.

@karlitschek

Copy link
Copy Markdown
Contributor

👍 Looks Good but Not tested

@PVince81

PVince81 commented Nov 6, 2013

Copy link
Copy Markdown
Contributor Author

Going to test whether local:// storages are auto-migrated to home:// (from #5591). I have a feeling that it won't.

@ghost

ghost commented Nov 6, 2013

Copy link
Copy Markdown

@PVince81

PVince81 commented Nov 6, 2013

Copy link
Copy Markdown
Contributor Author

I tried migrating from v5.0.12 to v5.0.13, then v6 beta 2.
The storage table still contains the old entries:
local::/srv/www/htdocs/owncloud/data/user1/
local::/srv/www/htdocs/owncloud/data/user2/

Either we need to automatically migrate these to the new "home::" format or I'll need to modify the wrapping detection from this PR. @icewind1991

I'll start looking into the latter.

@icewind1991

Copy link
Copy Markdown
Contributor

I think the latter is a safer approach

@PVince81

PVince81 commented Nov 6, 2013

Copy link
Copy Markdown
Contributor Author

Thanks for the info.

Is there a way to find out whether to find out the user name and whether it's a home dir from the $storage object with "local::/srv/www/htdocs/owncloud/data/user2/" ?
I don't think string manipulation will be safe here.

@ghost ghost assigned PVince81 Nov 6, 2013
@icewind1991

Copy link
Copy Markdown
Contributor

Not reliably from the storage path, using the mount point, as it was done before this PR, is reliable since homes are always mounted to /$user/

@PVince81

PVince81 commented Nov 7, 2013

Copy link
Copy Markdown
Contributor Author

Hmm, the problem is that I need to do it for other users as well.
If user1 has access to a shared dir from user2, that one will also appear in the list of mountpoints.
So far, we only checked for the current logged in user's mountpoint.
Are you suggesting to assume that if we have "/something/" as mountpoint, that "something" is guaranteed to be a user name ?

@PVince81

PVince81 commented Nov 7, 2013

Copy link
Copy Markdown
Contributor Author

I've rebased everything. Please have a look.

I'm now extracting the user name from the mount point.

Note that you won't see any effects from this PR until #5701 is merged. This is because even though the quota wrapper is used, the "folder size" isn't propagated yet so it doesn't update the folder owner's quota. I've fixed that in that other PR.

@ghost

ghost commented Nov 7, 2013

Copy link
Copy Markdown

@PVince81

Copy link
Copy Markdown
Contributor Author

Rebased.

@ghost

ghost commented Nov 11, 2013

Copy link
Copy Markdown

@PVince81

Copy link
Copy Markdown
Contributor Author

Please review @schiesbn @icewind1991 @DeepDiver1975

@schiessle

Copy link
Copy Markdown
Contributor

code looks good to me 👍

@PVince81

Copy link
Copy Markdown
Contributor Author

@icewind1991 would be good to know what you think

Comment thread lib/private/util.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using something like

if($storage instanceof \OC\Files\Storage\Home)
    $user = $storage->getUser()->getUID(); //getUser() would need to be added

would simplify this whole bit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I didn't use it back then because we didn't have the new "always wrap in Home storage" logic.
I'll change it.

Vincent Petry added 2 commits November 21, 2013 12:04
When accessing a shared folder, the folder's owner appears as mountpoint
but wasn't wrapped by a quota storage wrapper.

This fix makes sure that all home storages are wrapped by a quota
storage wrapper, if applicable, to make sure quotas are respected when
uploading into shared folders.
To find out whether to apply a quota, we now try and detect whether the
storage to wrap is a "Home" storage.
@PVince81

Copy link
Copy Markdown
Contributor Author

@icewind1991 I've rebased and the second commit is the change you suggested. Please have a look.

@ghost

ghost commented Nov 21, 2013

Copy link
Copy Markdown

@icewind1991

Copy link
Copy Markdown
Contributor

👍

PVince81 pushed a commit that referenced this pull request Nov 21, 2013
Quota storage wrapper is now used for all users in sharing mode
@PVince81
PVince81 merged commit d0265f3 into master Nov 21, 2013
@PVince81
PVince81 deleted the quota-sharing-wrapotherusershome branch November 21, 2013 14:59
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants