Issues deleting users

Hi,

I have come across a strange issue in a deployment with test users and SAML authentication.

If a new user creates an account on the system, and only visits myedx.com, I can successfully delete the account from the Django admin interface. However, if the user visits the CMS as well (e.g. studio.myedx.com, even without applying for permission to create courses), it’s not possible to delete the user account from the Django interface.

I found this related post: Error while deleting user from django

However, when I run:
tutor local run lms ./manage.py lms manage_user --remove <username> <user_email>

I get:
django.db.utils.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (openedx.course_creators_coursecreator, CONSTRAINT course_creators_coursecreator_user_id_e4da548d _fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user (id))')

If I then try to delete the user account from the CMS instead:
tutor local run cms ./manage.py cms manage_user --remove <username> <user_email>

I get:
django.db.utils.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (openedx.social_auth_usersocialauth, CONSTRAINT social_auth_usersocialauth_user_id_17d28448_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user (id))')

The solution I have found so far is to first unlink the user account from the SAML account and then delete the user account from the CMS again:
tutor local run cms ./manage.py cms manage_user --remove <username> <user_email>

Is this the expected behavior?

I am able to unlink the user account because these are test users created by myself. However, is it possible to unlink user accounts from 3rd party authentication systems for other users, even being superuser?

Many thanks,
Sebastian

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.