Skip to content

Don't allow deletion of previous staff users #2759

Description

@janno42

Users who edited evaluations (as managers) or uploaded grades (as grade uploaders) and no longer have those roles must not be deleted during bulk updates in order to keep their log entries intact. Currently, the bulk update fails when such a user is selected for deletion:

ProtectedError at /staff/user/bulk_update ("Cannot delete some instances of model 'UserProfile' because they are referenced through protected foreign keys: 'LogEntry.user'

To preserve their history, can_be_deleted_by_manager for users with such log entries should be False, so they won't be deleted.

Activity

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

Metadata

Metadata

Assignees

Labels

[C] BackendFocuses on backend implementation[P] MajorMajor priority[S] SmallThis issue should require only small changes.[T] BugThis is a bug. We don't like it. Please get rid of it.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions