Can't delete a user who submitted assignments to the LMS via LTI

Bug #1795273 reported by Kristina Hoeppner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Cecilia Vela Gurovic

Bug Description

I wanted to delete a user who submitted assignments to LTI (both locked and unlocked), but only got the error messages below.

To replicate
---------------

1. Set up LTI between Moodle and Mahara.
3. Create 2 activities: One to keep the portfolio locked, one to unlock it.
3. Submit portfolios to each as a student.
4. Delete the student account on Mahara.
Expected result: Account is deleted.
Actual result: Delete action is aborted.

[WAR] 73 (lib/adodb/adodb-exceptions.inc.php:45) Array to string conversion
Call stack (most recent first):

    log_message("Array to string conversion", 8, true, true, "/var/www/ws-mahara-prod-mahara/releases/2018092704...", 45) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/errors.php:521
    error(8, "Array to string conversion", "/var/www/ws-mahara-prod-mahara/releases/2018092704...", 45, array(size 7)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/adodb/adodb-exceptions.inc.php:45
    ADODB_Exception->__construct("postgres8", "adodb_throw", -1, "ERROR: update or delete on table "view" violates ...", "DELETE FROM "view" WHERE "id" = ? ", array(size 1), object(ADODB_postgres8)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/adodb/adodb-exceptions.inc.php:80
    adodb_throw("postgres8", "adodb_throw", -1, "ERROR: update or delete on table "view" violates ...", "DELETE FROM "view" WHERE "id" = ? ", array(size 1), object(ADODB_postgres8)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/adodb/adodb.inc.php:313
    ADODB_TransMonitor("postgres8", "adodb_throw", -1, "ERROR: update or delete on table "view" violates ...", "DELETE FROM "view" WHERE "id" = ? ", array(size 1), object(ADODB_postgres8)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/adodb/adodb.inc.php:1263
    ADOConnection->_Execute("DELETE FROM "view" WHERE "id" = ? ", array(size 1)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/adodb/adodb.inc.php:1223
    ADOConnection->Execute("DELETE FROM "view" WHERE "id" = ? ", array(size 1)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/dml.php:981
    delete_records("view", "id", "84") at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/view.php:1016
    View->delete() at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/user.php:1601
    delete_user(8) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/admin/users/bulk.php:323
    delete_submit(object(Pieform), array(size 3)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/pieforms/pieform.php:164
    Pieform::process(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/mahara.php:5195
    pieform(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/admin/users/bulk.php:188

[WAR] 73 (lib/errors.php:859) Failed to get a recordset: postgres8 error: [-1: ERROR: update or delete on table "view" violates foreign key constraint "ltiassesubm_vie_fk" on table "lti_assessment_submission"
DETAIL: Key (id)=(84) is still referenced from table "lti_assessment_submission".] in adodb_throw(DELETE FROM "view" WHERE "id" = ? , Array)Command was: DELETE FROM "view" WHERE "id" = ? and values was (0:84)
Call stack (most recent first):

    log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/errors.php:95
    log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/errors.php:859
    SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/dml.php:984
    delete_records("view", "id", "84") at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/view.php:1016
    View->delete() at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/user.php:1601
    delete_user(8) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/admin/users/bulk.php:323
    delete_submit(object(Pieform), array(size 3)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/pieforms/pieform.php:164
    Pieform::process(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/mahara.php:5195
    pieform(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/admin/users/bulk.php:188

[WAR] 73 (lib/dml.php:984) Failed to get a recordset: postgres8 error: [-1: ERROR: update or delete on table "view" violates foreign key constraint "ltiassesubm_vie_fk" on table "lti_assessment_submission"
DETAIL: Key (id)=(84) is still referenced from table "lti_assessment_submission".] in adodb_throw(DELETE FROM "view" WHERE "id" = ? , Array)Command was: DELETE FROM "view" WHERE "id" = ? and values was (0:84)
Call stack (most recent first):

    delete_records("view", "id", "84") at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/view.php:1016
    View->delete() at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/user.php:1601
    delete_user(8) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/admin/users/bulk.php:323
    delete_submit(object(Pieform), array(size 3)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/pieforms/pieform.php:164
    Pieform::process(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/lib/mahara.php:5195
    pieform(array(size 4)) at /var/www/ws-mahara-prod-mahara/releases/20180927041435/admin/users/bulk.php:188

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/9155

Changed in mahara:
assignee: nobody → Cecilia Vela Gurovic (ceciliavg)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9155
Committed: https://git.mahara.org/mahara/mahara/commit/3a45fcd39b9d7d131fe1e7e2dd4cae1855e32e0c
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 3a45fcd39b9d7d131fe1e7e2dd4cae1855e32e0c
Author: Cecilia Vela Gurovic <email address hidden>
Date: Mon Oct 1 09:22:16 2018 +1300

Bug 1795273: delete lti submission when deleting a page

When a user is to be deleted, the LTI submission needs to be removed
for the system to delete the user properly.

behatnotneeded

Change-Id: Ibc9ca94c85f2fd668772801b9bb85370151304f4

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Changed in mahara:
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.