Page MenuHomekolab.org

Restoring a user/domain
ClosedPublic

Authored by machniak on Dec 11 2020, 3:45 PM.

Details

Reviewers
vanmeeuwen
Group Reviewers
Restricted Project
Commits
rK2022a3f5a265: Restoring a user/domain
Summary

Added artisan user:restore and domain:restore commands

Test Plan

./phpunit

Diff Detail

Repository
rK kolab
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

machniak requested review of this revision.Dec 11 2020, 3:45 PM
machniak created this revision.
vanmeeuwen requested changes to this revision.Dec 23 2020, 11:35 AM
vanmeeuwen added a subscriber: vanmeeuwen.
vanmeeuwen added inline comments.
src/app/Domain.php
271 ↗(On Diff #5308)

Isn't STATUS_LDAP_READY removed when the associated job is done?

src/app/Jobs/Domain/CreateJob.php
20 ↗(On Diff #5308)

Marking a domain as deleted in LDAP is still valid, though, so I'd expect the domain to show up in LDAP with inetdomainstatus &= 8.

src/app/Observers/DomainObserver.php
134

When a domain is restored, we don't update the updated_at column of the entitlements table because it's used to track payment status / due dates for new charges.

150

I believe created_at will remain what it was, which would be the expected result.

I also believe $domain->save() will automatically update updated_at.

src/app/Observers/UserObserver.php
290

Here too, please avoid touching updated_at.

src/app/User.php
733 ↗(On Diff #5308)

This should be an effect of having the associated jobs executed successfully, no?

This revision now requires changes to proceed.Dec 23 2020, 11:35 AM
machniak updated this revision to Diff 5704.Jan 8 2021, 12:04 PM
  • Complete restoring/restored events handlers in user and domain observers
  • Add test for user:restore command
  • Add domain:restore command
machniak updated this revision to Diff 5710.Jan 8 2021, 12:21 PM
  • Set proper status in user/domain DeleteJob
machniak retitled this revision from [Draft] Restoring a user account to Restoring a user/domain.Jan 8 2021, 12:21 PM
machniak edited the summary of this revision. (Show Details)
machniak updated this revision to Diff 5716.Jan 8 2021, 1:21 PM
  • Complete restoring/restored events handlers in user and domain observers
  • Add test for user:restore command
  • Add domain:restore command
  • Set proper status in user/domain DeleteJob
vanmeeuwen requested changes to this revision.Feb 4 2021, 2:35 PM
vanmeeuwen added inline comments.
src/app/Console/Commands/DomainRestore.php
46

I don't understand this part.

When john@kolab.org deletes itself and needs to be restored, is the situation not always that both the User as well as the Domain are deleted?

Does it then mandate that first user:restore john@kolab.org is ran?

This revision now requires changes to proceed.Feb 4 2021, 2:35 PM
machniak added inline comments.Feb 4 2021, 2:41 PM
src/app/Console/Commands/DomainRestore.php
46

It's just that you cannot restore a domain before restoring the user. But the command is still useful if you restore a domain (one of many) on an existing account.

vanmeeuwen accepted this revision.Feb 16 2021, 9:12 AM
This revision is now accepted and ready to land.Feb 16 2021, 9:12 AM
This revision was automatically updated to reflect the committed changes.