Problems with ldap user sync database error

Bug #1792638 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Unassigned
17.04
Fix Released
High
Unassigned
17.10
Fix Released
High
Unassigned
18.04
Fix Released
High
Unassigned
18.10
Fix Released
High
Unassigned

Bug Description

When trying to use the LDAP user_sync() function there is this error

[DBG] a0 (lib/dml.php:157) mysqli error: [1171: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead] in EXECUTE("CREATE TEMPORARY TABLE auth_ldap_extusers_temp (
[DBG] a0 (lib/dml.php:157) extusername VARCHAR(64) DEFAULT NULL,
[DBG] a0 (lib/dml.php:157) firstname TEXT,
[DBG] a0 (lib/dml.php:157) lastname TEXT,
[DBG] a0 (lib/dml.php:157) email VARCHAR(255) DEFAULT NULL,
[DBG] a0 (lib/dml.php:157) studentid TEXT,
[DBG] a0 (lib/dml.php:157) preferredname TEXT,
[DBG] a0 (lib/dml.php:157) CONSTRAINT PRIMARY KEY (extusername)
[DBG] a0 (lib/dml.php:157) )ENGINE=innodb")

It looks like we need to make the 'extusername' column a not null column

Revision history for this message
Robert Lyon (robertl-9) wrote :
Changed in mahara:
milestone: none → 18.10.0
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Robert Lyon (robertl-9) wrote :

There is also the problem with the headers sent error - the problem happens after LDAP sync finishes and is happening due to this:

Once the sync_users script has run the last step is to log out current user so they are forced to login to see any changes. Part of the logout function is to set a cookie and this can't be done after headers already sent.

I've added a fix to the patch handle the setcookie function to be skipped if headers already set
https://reviews.mahara.org/#/c/9137/

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9137
Committed: https://git.mahara.org/mahara/mahara/commit/254103d61b9165c295ca9bfdab2f339d9a8d16cc
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 254103d61b9165c295ca9bfdab2f339d9a8d16cc
Author: Robert Lyon <email address hidden>
Date: Sat Sep 15 08:47:22 2018 +1200

Bug 1792638: Problem with ldap sync temp table

And also with calling $USER->logout();

And also with showing missing ldap server info for a user

behatnotneeded

Change-Id: I03656d286bbf2e56416151a52b2051235f9364df
Signed-off-by: Robert Lyon <email address hidden>

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

Patch for "18.04_STABLE" branch: https://reviews.mahara.org/9145

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9145
Committed: https://git.mahara.org/mahara/mahara/commit/f2da0c00ad33b2b4e7bb8736ff9bb2570a9e0872
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.04_STABLE

commit f2da0c00ad33b2b4e7bb8736ff9bb2570a9e0872
Author: Robert Lyon <email address hidden>
Date: Sat Sep 15 08:47:22 2018 +1200

Bug 1792638: Problem with ldap sync temp table

And also with calling $USER->logout();

And also with showing missing ldap server info for a user

behatnotneeded

Change-Id: I03656d286bbf2e56416151a52b2051235f9364df
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 254103d61b9165c295ca9bfdab2f339d9a8d16cc)

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

Patch for "17.10_STABLE" branch: https://reviews.mahara.org/9146

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "17.04_STABLE" branch: https://reviews.mahara.org/9147

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9147
Committed: https://git.mahara.org/mahara/mahara/commit/00475c2a03d2a877f30fbc7df866dc7b390cda3a
Submitter: Robert Lyon (<email address hidden>)
Branch: 17.04_STABLE

commit 00475c2a03d2a877f30fbc7df866dc7b390cda3a
Author: Robert Lyon <email address hidden>
Date: Sat Sep 15 08:47:22 2018 +1200

Bug 1792638: Problem with ldap sync temp table

And also with calling $USER->logout();

And also with showing missing ldap server info for a user

behatnotneeded

Change-Id: I03656d286bbf2e56416151a52b2051235f9364df
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 254103d61b9165c295ca9bfdab2f339d9a8d16cc)
(cherry picked from commit f2da0c00ad33b2b4e7bb8736ff9bb2570a9e0872)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/9146
Committed: https://git.mahara.org/mahara/mahara/commit/220f29cd3288a12a3e25dfc90eb95d8764140e77
Submitter: Robert Lyon (<email address hidden>)
Branch: 17.10_STABLE

commit 220f29cd3288a12a3e25dfc90eb95d8764140e77
Author: Robert Lyon <email address hidden>
Date: Sat Sep 15 08:47:22 2018 +1200

Bug 1792638: Problem with ldap sync temp table

And also with calling $USER->logout();

And also with showing missing ldap server info for a user

behatnotneeded

Change-Id: I03656d286bbf2e56416151a52b2051235f9364df
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 254103d61b9165c295ca9bfdab2f339d9a8d16cc)
(cherry picked from commit f2da0c00ad33b2b4e7bb8736ff9bb2570a9e0872)

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.