Skip to content

Retrieve user home folder before deleting a user#16830

Closed
MorrisJobke wants to merge 2 commits into
masterfrom
fix-delete-homeidr-on-userdelete
Closed

Retrieve user home folder before deleting a user#16830
MorrisJobke wants to merge 2 commits into
masterfrom
fix-delete-homeidr-on-userdelete

Conversation

@MorrisJobke

Copy link
Copy Markdown
Contributor

A first try to fix #16588

@blizzz Somehow this doesn't retrieve the correct home folders if a different folder name is used by LDAP. I always get the user home dir with UUID instead of the specified attribute.

  • set the home dir naming schema to cn
  • everything works, but once I delete a user from LDAP, list it via the ldap:show-remnants command and delete the user the wrong folder is choosen - could this e related to the homeFoldersToKill attribute in the ldap backend?

@blizzz

blizzz commented Jun 9, 2015

Copy link
Copy Markdown
Contributor

@MorrisJobke the correct / used home folder is supposed to be saved in the user preferences table as "homePath" with appid "user_ldap" and this is what is supposed to be returned by getHome for deleted users.

@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@MorrisJobke the correct / used home folder is supposed to be saved in the user preferences table as "homePath" with appid "user_ldap" and this is what is supposed to be returned by getHome for deleted users.

Then this is somehow broken :(

@blizzz

blizzz commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

The value is set when getHome() was called on this user, but not before OC 7.0.5. This does work, but the folder is not being delete - i just reproduced with master.

https://github.com/owncloud/core/blob/master/apps/user_ldap/user_ldap.php#L239 has the correct value.

The problem is that https://github.com/owncloud/core/blob/master/apps/user_ldap/user_ldap.php#L253 does not return the deleted user any more, which is needed to clean up that stuff.

https://github.com/owncloud/core/blob/master/apps/user_ldap/user_ldap.php#L200 returns a OCA\user_ldap\USER_LDAP instance the second time ?! Probably because user values are deleted and thus also the deleted flag.

Moving this block https://github.com/owncloud/core/blob/master/apps/user_ldap/user_ldap.php#L257 in front of the userExists check would fix the issue and delete the folder correctly.

@blizzz

blizzz commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

Actually, that was also the reason to keep this in an instance variable…

@blizzz

blizzz commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

@MorrisJobke I opened a new PR FWIW: #16890

@blizzz blizzz closed this Jun 11, 2015
@MorrisJobke
MorrisJobke deleted the fix-delete-homeidr-on-userdelete branch June 11, 2015 17:11
@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@blizzz Nevertheless it feels wrong to delete a user first and afterwards fetch the home dir of that user. Considering other backends that doesn't handle this in a way like the LDAP backend does.

@blizzz

blizzz commented Jun 17, 2015

Copy link
Copy Markdown
Contributor

@MorrisJobke there you have a point, and how user management works right now is somewhat special. The remove from group actions are also already special.

Comment thread lib/private/user/user.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 takes the uid as parameter wrong getHome() i had in mind

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.

I just was confused ;)

@MorrisJobke
MorrisJobke restored the fix-delete-homeidr-on-userdelete branch June 17, 2015 14:28
@MorrisJobke MorrisJobke reopened this Jun 17, 2015
@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@nickvergessen @PVince81 @blizzz Reviewers needed.

@MorrisJobke MorrisJobke added this to the 8.1.1-next-maintenance milestone Jun 24, 2015
@blizzz

blizzz commented Jun 24, 2015

Copy link
Copy Markdown
Contributor

@MorrisJobke could you rebase so we can easily test with #16890 which was merged inbetween?

@MorrisJobke
MorrisJobke force-pushed the fix-delete-homeidr-on-userdelete branch from c3a3518 to 1fe2536 Compare June 24, 2015 15:44
@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@blizzz Done

@blizzz

blizzz commented Jun 30, 2015

Copy link
Copy Markdown
Contributor

Doesn't work with LDAP, the default ~ would be returned. LDAP's deleteUser and getHome needs to be modified as well, because they rely on how this is done here. getHome() will just return false because the user does not exist and $this->homesToKill was not set at the time.

Want me to change it accordingly?

@MorrisJobke

Copy link
Copy Markdown
Contributor Author

Want me to change it accordingly?

I would say yes, because this is a "feature" of the LDAP implementation because it expects the core to behave wrong. 🙈 🙊 🙉

@MorrisJobke MorrisJobke modified the milestones: 8.2-next, 8.1.1-next-maintenance Jul 3, 2015
@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@blizzz Ping

@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@blizzz @nickvergessen @Xenopathic Can I get some reviews for this? Thanks :)

@MorrisJobke

Copy link
Copy Markdown
Contributor Author

@blizzz @nickvergessen @Xenopathic Can I get some reviews for this? Thanks :)

And opinions ;)

@MorrisJobke

Copy link
Copy Markdown
Contributor Author

I almost started to work on it, but since related LDAP stuff changes in #18469 and that one is more important, let's get that in first.

It's merged :) Do you have time to update the mentioned methods?

@DeepDiver1975 DeepDiver1975 modified the milestones: 9.0-next, 8.2-current Oct 8, 2015
@DeepDiver1975

Copy link
Copy Markdown
Member

moving this to 9.0

@MorrisJobke
MorrisJobke force-pushed the fix-delete-homeidr-on-userdelete branch from 1fe2536 to bf429ae Compare December 1, 2015 09:30
@MorrisJobke

Copy link
Copy Markdown
Contributor Author

Rebased just because ...

@blizzz

blizzz commented Dec 3, 2015

Copy link
Copy Markdown
Contributor

Ha, yeah, sorry, facing deadline. 🙊

@MorrisJobke MorrisJobke modified the milestones: 9.1-next, 9.0-current Mar 4, 2016
@blizzz

blizzz commented Mar 31, 2016

Copy link
Copy Markdown
Contributor

I will give it another review and test.

@blizzz

blizzz commented Apr 6, 2016

Copy link
Copy Markdown
Contributor

No, this does not work without adjusting user_ldap either. The deleteUser() method adds the user folder to an array, so that getHome() will succeed and return the correct folder. Currently, getHome() would find out that the user is not existant and throw NoUserException.

I.e. user_ldap needs to be touched as well to have this working.

@PVince81

Copy link
Copy Markdown
Contributor

Any update ? How to move this forward ?

@blizzz

blizzz commented May 13, 2016

Copy link
Copy Markdown
Contributor

Wanted to start with a test, needs to be an integration test, want to have #23832 finished first

@PVince81 PVince81 modified the milestones: 9.2-next, 9.1-current Jun 17, 2016
@PVince81

Copy link
Copy Markdown
Contributor

Moving to 9.2. Also, there are conflicts.

@PVince81

PVince81 commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

@jvillafanez @butonic

@DeepDiver1975
DeepDiver1975 force-pushed the fix-delete-homeidr-on-userdelete branch from bf429ae to b2c21ba Compare October 19, 2016 15:43
@PVince81

PVince81 commented Apr 7, 2017

Copy link
Copy Markdown
Contributor

Funny thing, I fixed the same issue from a completely different context: #26848

@PVince81 PVince81 closed this Apr 7, 2017
@PVince81
PVince81 deleted the fix-delete-homeidr-on-userdelete branch April 7, 2017 16:08
@lock

lock Bot commented Aug 3, 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 3, 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.

[7.0.5] LDAP user can not be deleted.

5 participants