Skip to content

Do not copy skeleton on avatar access - #22410

Merged
DeepDiver1975 merged 1 commit into
masterfrom
fix_22119
Feb 19, 2016
Merged

DeepDiver1975 merged 1 commit into
masterfrom
fix_22119

Conversation

@rullzer

@rullzer rullzer commented Feb 15, 2016

Copy link
Copy Markdown
Contributor

Fixes #22119

We do the step from the getUserFolder function here. So we make sure
that the user folder exists. But do not create the files folder (we
don't need it here) and do not copy the skeleton.

Note that this will still be triggered once the getUserFolder is called.

Moved the unit tests to more intergration tests with the traits we have..

@PVince81 @DeepDiver1975 as promised.
@DeepDiver1975 as far as I can tell this fixes the issue... but please verify on your setup.

CC: @MorrisJobke @nickvergessen

@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @DeepDiver1975, @Xenopathic and @blizzz to be potential reviewers

Comment thread lib/private/avatarmanager.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.

This does not work in case the user home is defined by getHome ?

@blizzz

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.

Yes. You mean the LDAP home folder naming rule.

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.

Best would be to add a parameter to getUserFolder that allows to specify that the folder should not be generated if it doesn't exists and a exception should be thrown instead

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.

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.

I know - I wrote it :P

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.

So then if that would not work for the ldap naming scheme... then well... getUserFolder would just not work for ldap users...

Ah. Now I got it.

I tought about adding the extra parameter but I think that bring more harm... since then the returned folder changes... now it is /files and then it would just return which seems like asking for trouble.

I would throw a DoesNotExistException in that case. No other magic required. Let the callee deal with it if there is no need to create a user folder.

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.

Yeah but we do a bit more here. Basically I want the user folder to be created. Just not the <user>/files folder and no skeleton stuff to be copied.

Feels weird to have that with a flag... I would expect such a flag would either create or not... not create 1 but not the other...

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.

But lets do a different (less invasive) fix...

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.

Yeah but we do a bit more here. Basically I want the user folder to be created. Just not the /files folder and no skeleton stuff to be copied.

Feels weird to have that with a flag... I would expect such a flag would either create or not... not create 1 but not the other...

Good point. I didn't thought about this. :(

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.

Ok fixed it... now we just do a get on the rootfolder... if the folder is not there a NotFoundException will be thrown... This is handled nicely by the avatar controller... We should think about a better solution for the avatar storage in 9.1. But for now this fix is as elegant (and non invasive) as it is going to get I think.

Fixes #22119

Just try to get the folder of the user. If it is not there a
NotFoundException will be thrown. Which will be handled by the avatar
endpoint.
@rullzer

rullzer commented Feb 16, 2016

Copy link
Copy Markdown
Contributor Author

@MorrisJobke please have another look :)

@PVince81

Copy link
Copy Markdown
Contributor

Would also like to know what our filesystem master @icewind1991 thinks of this approach

* Basically we do not want to copy the skeleton folder
*/
\OC\Files\Filesystem::initMountPoints($userId);
$dir = '/' . $userId;

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.

This simply feels wrong for home folder naming rule setting in LDAP - but it magically also works with getUserFolder() for such an instance in another case I had yesterday 🙈

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.

the home folder naming is completely separate from the path within oc's virtual fs.

Inside oc's fs the user directory is always at /$userId/

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.

Yes, but that other PR removes that logic, see #22493

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.

If that works as intended, then I'm fine. Just want to make sure we don't break anything.

@icewind1991 can you double check ?

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.

The fs is manually setup here so #22493 doesn't affect this

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.

Right, makes sense.

Internally initMountPoints($userId) should be asking for the LDAP home and mount it as "/" . $userId. So it would work.

@PVince81

Copy link
Copy Markdown
Contributor

Tested with cron job + caldav, when retrieving the avatar it now doesn't copy the skeleton for every LDAP user 👍

@PVince81

Copy link
Copy Markdown
Contributor

Now seeing @MorrisJobke comment in detail, I retract my thumbs up 👎

It's best to never use getRootFolder() to then enter a user's folder.

How about adding an optional argument to getUserFolder($userId, $allowSkeleton = true).
If set to false, and the user has no skeleton/home, then return null instead of a user folder ?

@PVince81

Copy link
Copy Markdown
Contributor

👍

@rullzer

rullzer commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

@PVince81 @MorrisJobke how about an extra function to IRootFolder getUserRootFolder or whatever. That does all this. I can create an issue to clean that up a bit...

@rullzer

rullzer commented Feb 18, 2016

Copy link
Copy Markdown
Contributor Author

That way we keep the nice abstraction and pure unit tests.

@PVince81

Copy link
Copy Markdown
Contributor

how about an extra function to IRootFolder getUserRootFolder or whatever. That does all this. I can create an issue to clean that up a bit...

No... too many APIs then. Keep it as is.

Second review @icewind1991 @MorrisJobke @nickvergessen @schiesbn ?

@PVince81

Copy link
Copy Markdown
Contributor

@MorrisJobke @icewind1991 second review ? Or are you still against this change ?

@icewind1991

Copy link
Copy Markdown
Contributor

👍 looks good

DeepDiver1975 added a commit that referenced this pull request Feb 19, 2016
Do not copy skeleton on avatar access
@DeepDiver1975
DeepDiver1975 merged commit b5281b6 into master Feb 19, 2016
@DeepDiver1975
DeepDiver1975 deleted the fix_22119 branch February 19, 2016 15:06
@LukasReschke

Copy link
Copy Markdown
Contributor

This seems to have broken the user management: #22550

@rullzer
rullzer restored the fix_22119 branch February 25, 2016 20:23
@DeepDiver1975
DeepDiver1975 deleted the fix_22119 branch March 10, 2016 21:23
@lock

lock Bot commented Aug 7, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[master] Opening user management triggers skeletion copy on every user!

7 participants