Bug #4812

Deleting User Account with a Note throws 500 Server Error

Added by Jessica Bushey over 6 years ago. Updated over 4 years ago.

Status:VerifiedStart date:03/18/2013
Priority:HighDue date:
Assignee:Dan Gillean% Done:

0%

Category:User management
Target version:Release 2.2.0
Google Code Legacy ID: Tested version:1.3.1, 2.1, 2.2
Sponsored:No Requires documentation:

Description

User creates an Other Note in RAD
Saves archival description
Logs Out

Administrator logs in and selects User account to delete
ICA-AtoM warns Admin that User has a note attached
Admin proceeds with deleting account
ICA-AtoM asks for confirmation of delete, select Delete

Unexpected Error:
500 Error Screen
If you go back button on browser, User is still there but when you click on the User you get a white screen
I have attached the 500 Error Screen in dev mode below:

500 | Internal Server Error | PropelException
Unable to execute DELETE statement. [wrapped: SQLSTATE23000: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`atom`.`note`, CONSTRAINT `note_FK_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`))]
stack trace

at ()
in SF_ROOT_DIR/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/BasePeer.php line 165 ...
$affectedRows = $stmt->rowCount();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException("Unable to execute DELETE statement.",$e);
}
} // for each table
at BasePeer::doDelete(object('Criteria'), object('DebugPDO'))
in SF_ROOT_DIR/lib/model/om/BaseObject.php line 104 ...
at BaseObject::doDelete(object('Criteria'), object('DebugPDO'))
in SF_ROOT_DIR/lib/model/om/BaseObject.php line 708 ...
at BaseObject->delete(object('DebugPDO'))
in SF_ROOT_DIR/lib/model/QubitObject.php line 300 ...
at QubitObject->delete(null)
in SF_ROOT_DIR/lib/model/om/BaseActor.php line 480 ...
at BaseActor->delete(null)
in SF_ROOT_DIR/lib/model/QubitActor.php line 179 ...
at QubitActor->delete()
in SF_ROOT_DIR/apps/qubit/modules/user/actions/deleteAction.class.php line 35 ...
at UserDeleteAction->execute(object('sfWebRequest'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfExecutionFilter.class.php line 92 ...
at sfExecutionFilter->executeAction(object('UserDeleteAction'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfExecutionFilter.class.php line 78 ...
at sfExecutionFilter->handleAction(object('sfFilterChain'), object('UserDeleteAction'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfExecutionFilter.class.php line 42 ...
at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/lib/filter/QubitMeta.class.php line 41 ...
at QubitMeta->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/lib/filter/QubitSslRequirementFilter.class.php line 35 ...
at QubitSslRequirementFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/lib/filter/QubitLimitIp.class.php line 39 ...
at QubitLimitIpFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/lib/filter/QubitSettingsFilter.class.php line 31 ...
at QubitSettingsFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfBasicSecurityFilter.class.php line 72 ...
at sfBasicSecurityFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfRenderingFilter.class.php line 33 ...
at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/plugins/sfHistoryPlugin/lib/sfHistoryPluginFilter.class.php line 18 ...
at sfHistoryPluginFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/lib/filter/QubitTransactionFilter.class.php line 40 ...
at QubitTransactionFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR/vendor/symfony/lib/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_ROOT_DIR/vendor/symfony/lib/controller/sfController.class.php line 238 ...
at sfController->forward('user', 'delete')
in SF_ROOT_DIR/vendor/symfony/lib/controller/sfFrontWebController.class.php line 48 ...
at sfFrontWebController->dispatch()
in SF_ROOT_DIR/vendor/symfony/lib/util/sfContext.class.php line 170 ...
at sfContext->dispatch()
in SF_ROOT_DIR/qubit_dev.php line 12 ...

symfony settings ...
request ...
response ...
user ...
global vars ...

symfony v.1.4.19-DEV - php 5.3.2-1ubuntu4.14
for help resolving this issue, please visit http://www.symfony-project.org/.
Debug toolbar


Related issues

Related to Access to Memory (AtoM) - Bug #3063: Can't delete a user if they have created a note Verified

History

#1 Updated by Jessica Bushey over 6 years ago

If you click on User Name after trying to delete and getting 500 error screen, you get this:

Notice: Undefined property: sfRoute::$resource in /var/www/atom/apps/qubit/modules/user/actions/indexAction.class.php on line 24

Fatal error: Call to a member function getNotes() on a non-object in /var/www/atom/apps/qubit/modules/user/actions/indexAction.class.php on line 35

#2 Updated by Dan Gillean over 6 years ago

  • Target version deleted (Release 1.4.0)

This issue duplicates concerns addressed in #3063 through the addition of the inactive checkbox to the user profile. If a user has a note in the system, instead of deleting the user, an admin should mark the user as inactive. See #3603 for more details.

This issue has been left active because the above is a stop-gap measure. While the functionality is useful, the ideal behaviour would be:

- AtoM detects if the user has a note in the system
- If YES: delete button is not shown
- IF NO: delete button appears

Ability to mark a user as inactive should remain.

#4 Updated by Dan Gillean almost 5 years ago

  • Priority changed from Medium to High
  • Target version set to Release 2.2.0
  • Tested version 1.3.1, 2.1, 2.2 added

Updating this issue because it has become relevant for a client - and because, if the user cannot be deleted, then the option to delete the user should not be present.

After attempting to delete a user who has notes, it seems as if a partial delete is completed - so the user's slug is deleted, but when the referential integrity violation is encountered for the notes, the system throws the 500 error. Consequently, the user is still listed in the Users page, but becomes inaccessible without a slug - the URL for the user, when the link is hovered over, is now /;user - which leads to a white page.

If a user cannot be deleted, then the delete button should be hidden and the delete action for the page should be rendered inaccessible.

#5 Updated by Mike Gale over 4 years ago

  • Status changed from New to In progress
  • Assignee changed from Jesús García Crespo to Mike Gale

#6 Updated by Mike Gale over 4 years ago

  • Status changed from In progress to Code Review
  • Assignee changed from Mike Gale to José Raddaoui Marín

David, Dan and I decided that as a short term solution we will simply disassociate notes with their users if said users are about to be deleted. This will sidestep the 500 error.

A longer term solution we may want to consider in the future is changing the db schema to use a string field in the notes table rather than a FK to the user table, so deleting users won't break things + we will still retain the username information for the note.

https://github.com/artefactual/atom/pull/126

#7 Updated by José Raddaoui Marín over 4 years ago

  • Status changed from Code Review to Feedback
  • Assignee changed from José Raddaoui Marín to Mike Gale

#8 Updated by Mike Gale over 4 years ago

  • Status changed from Feedback to QA/Review
  • Assignee changed from Mike Gale to Dan Gillean

#9 Updated by Dan Gillean over 4 years ago

  • Status changed from QA/Review to Verified

Also available in: Atom PDF