Administrator cannot delete a user.

Bug #742208 reported by Fumito Mizuno
4
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sahana-Eden
Fix Released
Medium
Fran Boon

Bug Description

I tried to delete a user.

1. I clicked User Management -> Users in eden/admin/index.
2. I clicked "Delete" of a user.
3. The message "Integrity error: record can not be deleted while it is referenced by other records" is displayed.

I tried in japan.sahanafoundation.org/ r1893 (2011-03-15 19:05:51) .
In older version, r1583 (2010-12-20 12:21:42), I tested and I can delete a user.

Revision history for this message
Fran Boon (flavour) wrote :

This is the PostgreSQL error log:
ERROR: update or delete on table "auth_user" violates foreign key constraint "pr_person_owned_by_user_fkey" on table "pr_person"
DETAIL: Key (id)=(84) is still referenced from table "pr_person".

So the issue is that whenever an auth_user account is registered, we create an associated pr_person account & set the pr_person record to be owned by this auth_user (so a login can always modify their own record).

Options that we have for deleting auth_user accounts:
* Delete the associated pr_person record
* Blank the owned_by field in the associated pr_person account
- although this will only be easy for the pr_person, not for all the other records this user has created.
* Prompt user to choose between these 2 options
* Do a 'soft' delete of the user (i.e. add the 'deleted' field to the auth_user table, the framework should take care of the rest)
* Never delete a user account but only Disable
- in which case we should replace the 'Delete' Action button with one which says 'Disable'

I would choose one of the last 2 options.
In fact even if we make accounts soft deletable, I think perhaps replacing the 'Delete' Action button with a 'Disable' one is best.

Thoughts?

Revision history for this message
Fumito Mizuno (ounziw) wrote :

japan.sahanafoundation.org/ r1893 (2011-03-15 19:05:51) uses postgresql.
My test version, r1583 (2010-12-20 12:21:42), uses sqlite.

Revision history for this message
Fran Boon (flavour) wrote :

Right, that'll be why you don't see it locally then - older versions of sqlite don't support Ref Integrity.
The one which comes with Python in current Ubuntu does as does Python 2.7.1 on Windows.

Revision history for this message
Fran Boon (flavour) wrote :

Fixed in r1977

Changed in sahana-eden:
status: New → Fix Committed
assignee: nobody → Fran Boon (flavour)
importance: Undecided → Medium
nursix (nursix.org)
Changed in sahana-eden:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.