Skip to content
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

Include occ command for removing orphaned accounts as a maintenance task #4091

Open
skruehoetl opened this issue Nov 18, 2020 · 1 comment
Open

Comments

@skruehoetl
Copy link

Feature Request

Due to issues with the user account removal in older mail versions, orphaned accounts could be left over in the oc_mail_accounts table (probably #3135), resulting in "invisible Ghost accounts" in the mail app itself (they were not there, but the app expected multple inboxes) and errors displaying mails in the widget (see #3819).

I think, a feature allowing for a controlled/guided removal of these accounts would benefit self-made admins such as myself who are not too comfortable writing "DELETE FROM oc_mail_accounts WHERE ..." statements in SQL.

Summary

Since this is would not be a feature for regular use, I think it would best be kept as part of the "occ" maintenance tool.

As the admin of a nextcloud instance, I'd like to be able to log into the shell of my nextcloud and issue a command like "php occ mail:list-orphaned-accounts" after which the orphaned accounts are identified and listed with id, userid, server, ... , followed by "php occ mail:delete-orphaned-account 1" after which the account with the corresponding id is deleted.

... probably, in the background, there would have to be something like "DELETE FROM oc_mail_accounts WHERE id=1" but the user/admin would not have to know about SQL and the 'magic' would be the identification of the orphaned accounts. (In my case, I could only go via error messages - there's probably a smarter way to do that.)

@ChristophWurst
Copy link
Member

For more context it's about Nextcloud accounts deleted before #3009. But I'm also not sure if every user back-end emits the user deleted event, so it doesn't hurt to have this additional cleanup command.

The rough steps are

  • Iterate over all mail accounts or possibly just the grouped user_id column
  • Look up the user account through the user back-end
  • If the user does not exist, drop the mail account(s) of that UID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants