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

BUGFIX: Remove users personal workspace on user deletion #5470

Open
wants to merge 1 commit into
base: 9.0
Choose a base branch
from

Conversation

mhsdesign
Copy link
Member

With #5146 indeed most problems outlined in #4566 were solved. Now one non-feature point is kindof left open:

a user Foo has a personal workspace named user-Foo. If the user is deleted and a new user named Foo is created it will use the previously still existent workspace user-Foo.

In the current state this will no longer happen as WorkspaceService::getPersonalWorkspaceForUser operates on the neos UUID user identifier and not the name of the account. Recreating a new user with the same name would mean it will get the workspace Foo2. So the only part that is not "fixed" yet is that deleting a user does not cleanup its workspaces.

This change adds a query to determine all content repositories a user was active in and then proceeds to delete the workspaces.

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

With neos#5146 indeed most problems outlined in neos#4566 were solved. Now one non-feature point is kindof left open:

> a user Foo has a personal workspace named user-Foo. If the user is deleted and a new user named Foo is created it will use the previously still existent workspace user-Foo.

In the current state this will no longer happen as `WorkspaceService::getPersonalWorkspaceForUser` operates on the neos UUID user identifier and not the name of the account. Recreating a new user with the same name would mean it will get the workspace `Foo2`. So the only part that is not "fixed" yet is that deleting a user does not cleanup its workspaces.

This change adds a query to determine all content repositories a user was active in and then proceeds to delete the workspaces.
@mhsdesign
Copy link
Member Author

An alternative - possible more stable solution would be: Let the workspaces be orphaned for a while and have a cleanup command to take care of them. Doing the deletion across all repositories from the UserService and that one request is dangerous as if any of the crs contain an error the whole deletion fails partly.

A cleanup cr command might seem inevitable after all all alone to rebase all users workspaces for once in a while. That could then check if any unknown user ids are in the workspace metadata and go a head to clean them.

So i like this change but a second after making it im doubting it already :D

@mhsdesign mhsdesign marked this pull request as ready for review February 21, 2025 16:58
@nezaniel nezaniel self-requested a review February 21, 2025 16:58
Copy link
Member

@nezaniel nezaniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that personal workspace deletion should happen when users are deleted

+1

@mhsdesign
Copy link
Member Author

@nezaniel and me discussed that we prefer a synchronous behaviour as provided via this pr for now due to the fact that any commands to cleanup things have to be remembered and actually used once in a while. A cronjob is no requirement for neos and for the case a cr cannot be instantiated or is not up to date, deleting a user is not the major concern :)

Thus lets have this 8.3 like approach for now.

@mhsdesign
Copy link
Member Author

also as Neos 9 betas have been around for a while we also might need a migration strategy for old user workspace where the users where deleted. Deletion of such "orphaned" workspaces is not possible via CLI or workspace module:

./flow workspace:delete user-foo

Did not delete workspace "user-foo" because it is a personal workspace. Personal workspaces cannot be deleted manually.

I would say we can either offer a migration to handle that or simply respect the --force option to always allow deletion of user workspaces:

./flow workspace:delete user-foo --force

which should impose no problem as the user will get a new workspace assigned after login.

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

Successfully merging this pull request may close these issues.

2 participants