-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add force option to delete user home folder #37103
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
40bf115
to
3c2b433
Compare
I don't think the approach is good.
From our case, there is only one action, which is the |
Codecov Report
@@ Coverage Diff @@
## master #37103 +/- ##
============================================
+ Coverage 64.52% 64.54% +0.02%
- Complexity 19166 19207 +41
============================================
Files 1266 1267 +1
Lines 74938 75051 +113
Branches 1331 1331
============================================
+ Hits 48356 48445 +89
- Misses 26190 26214 +24
Partials 392 392
Continue to review full report at Codecov.
|
@jvillafanez give it a new try with a fake user |
Apart from the unit tests, there are a couple of problems to be fixed:
|
21a0567
to
3789028
Compare
It seems we have a huge mess with the hooks. Current solution: Alternative 1Include a The problem is that anyone could trigger events anywhere (which, in fact, is what we're doing). This is potentially dangerous because any app could trigger an "user deleted" event even though such event never happened, Alternative 2Change the I'll try this second approach |
e7ff977
to
4755eea
Compare
Add a force option to the user delete command in order to delete the users home folder if exists. Signed-off-by: Sujith H <[email protected]>
d0e50f8
to
1b223ed
Compare
} | ||
|
||
public function testGetAccountNotExistsButForceReturnAfterCache() { | ||
$this->accountMapper->expects($this->exactly(2)) // FIXME: second call shouldn't hit the mapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to decide what to do with this. The AccountMapper
should be called only once because the missing user should be cached (and stored as null) accordingly to what the UserManager
does, but the cache implementation ignore these missing users when asked if they're in the cache (hasKey
method returns false even if there is a key with a null value). This means that a second hit to the AccountMapper
will happen as shown by this test.
Either there is a bug in the CappedMemoryCache
class, or the UserManager
's behaviour is wrong. It isn't clear if the missing users should be cached or not by the UserManager
.
Add a force option to the user delete command
in order to delete the users home folder if
exists.
Signed-off-by: Sujith H [email protected]
Description
Add force option for the
user:delete
command, to delete the home folder of the user if available.Related Issue
https://github.com/owncloud/enterprise/issues/2969
Motivation and Context
Its been noticed that when users upgrade from 9.1.5 to 10 of core, the accounts table does not have the user details and neither the home entry added to it. Now if the backend had deleted a user before upgrade then oC admin will not be able to delete the oc user mapped to the ldap backend. Because the entry is missing in the accounts table. Under such condition it would be handy to delete the home folder of those users (i.e, for missing backend users).
How Has This Been Tested?
user:delete
with uid and --force, where uid is the user unavailable in the LDAP or say the deleted one.Screenshots (if appropriate):
Types of changes
Checklist: