Media can be left with invalid author UIDs if the account is cancelled/deleted

Created on 2 June 2023, over 1 year ago
Updated 16 September 2024, 3 months ago

Problem/Motivation

When canceling a user account, there are several options presented. Two of them are:

  • "Delete the account and make its content belong to the Anonymous user. This action cannot be undone."
  • "Delete the account and its content. This action cannot be undone."

If the first option it chosen, media that was owned by the user remains owned by the user, even though the account is deleted. From my brief testing, this didn't cause any immediate issues in browsing the media library, other than the author column in table view showing a confusing blank value.

If the second option is chosen, the user's owned media is not deleted.

Note the File module has the same problem: πŸ› When a user gets "cancelled reassign" uid's in the table file_managed don't get updated to the new uid (0) making them orphaned Needs work

Steps to reproduce

  1. Enable the Media module
  2. Login as "foo" admin user account
  3. Login as the user, and create an Image media entity
  4. Login as a separate "bar" admin user account
  5. Cancel the user account of "foo", and test both options presented above. In both cases, observe the media is not deleted, and the author UID field remains its original value in the database

Proposed resolution

There is a hook we the media module can respond to when this user cancel operation is invoked. It's meant to be used to actually clean up the content author references. The Node module does this, though it has issues;

πŸ› Revision user incorrectly appears as anonymous user when node author is cancelled Needs work
πŸ› Content moderation can wrongly set old revisions as default when they're resaved Needs review

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
MediaΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024