SAML Update user details on login option creating new email artefact on every login

Bug #1487464 reported by Kevin Rickis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon
1.10
Fix Released
High
Unassigned
1.9
Fix Released
High
Unassigned
15.04
Fix Released
High
Unassigned

Bug Description

Mahara version: 15.04.1

Issue: When a user logs in via SAML and the configuration option is set to update the user's details then a new email artefact is created every time.

I think I have traced the problem

saml/lib.php line #234 calls set_profile_field($user->id, 'email', $email);

lib/user.php lines #511-516 are a try{} in which $email = artefact_instance_from_type('email', $userid); is called.

This fails with the message "This artefact type is not a 'singular' artefact type" and so a new email artefact is created.

It will always fail because artefact/internal/lib.php lines #705-708 returns false for is_singular()

class ArtefactTypeEmail extends ArtefactTypeProfileField {
    public static function is_singular() {
        return false;
    }

Kevin Rickis (rdx565)
description: updated
Robert Lyon (robertl-9)
Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
milestone: none → 15.10.0
importance: Undecided → High
status: New → In Progress
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/5161

Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Kevin,

Thank you for this report.

There is indeed a bug in the artefact_instance_from_type() function. It checks for is singular() before checking the artefact_type 'email'.

I've added a patch to deal with this problem: https://reviews.mahara.org/#/c/5161/

Please let me know if it fixes this problem for you

Cheers

Robert

Revision history for this message
Kevin Rickis (rdx565) wrote :

Hi Robert,

yes that fixes the problem. :)

Cheers,

Kevin

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

Reviewed: https://reviews.mahara.org/5161
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/4eec36102eadf8da684806afe5600e79e28e7737
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 4eec36102eadf8da684806afe5600e79e28e7737
Author: Kevin Rickis <email address hidden>
Date: Mon Aug 24 09:50:47 2015 +1200

Bug 1487464: SAML creating new email artefact on login

Problem is the dealing with the email artefact type happens after the check
for is_singular(), which 'email' artefact type is not.

behatnotneeded

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

Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/5436

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

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/5437

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

Patch for "1.9_STABLE" branch: https://reviews.mahara.org/5438

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

Reviewed: https://reviews.mahara.org/5438
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/3aeefdf1b83547303df0d9539bef9d169a8627eb
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.9_STABLE

commit 3aeefdf1b83547303df0d9539bef9d169a8627eb
Author: Kevin Rickis <email address hidden>
Date: Mon Aug 24 09:50:47 2015 +1200

Bug 1487464: SAML creating new email artefact on login

Problem is the dealing with the email artefact type happens after the check
for is_singular(), which 'email' artefact type is not.

behatnotneeded

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

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

Reviewed: https://reviews.mahara.org/5437
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/0ac92e839662e22d6913a24609633ee19a46cfe1
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit 0ac92e839662e22d6913a24609633ee19a46cfe1
Author: Kevin Rickis <email address hidden>
Date: Mon Aug 24 09:50:47 2015 +1200

Bug 1487464: SAML creating new email artefact on login

Problem is the dealing with the email artefact type happens after the check
for is_singular(), which 'email' artefact type is not.

behatnotneeded

Change-Id: I4d1ffbb2fb89cc705bf3e2e6211f22e24ca55b26
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 4eec36102eadf8da684806afe5600e79e28e7737)

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

Reviewed: https://reviews.mahara.org/5436
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/f1d1f7d6b1389644f2d799452002133bd8352692
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit f1d1f7d6b1389644f2d799452002133bd8352692
Author: Kevin Rickis <email address hidden>
Date: Mon Aug 24 09:50:47 2015 +1200

Bug 1487464: SAML creating new email artefact on login

Problem is the dealing with the email artefact type happens after the check
for is_singular(), which 'email' artefact type is not.

behatnotneeded

Change-Id: I4d1ffbb2fb89cc705bf3e2e6211f22e24ca55b26
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 4eec36102eadf8da684806afe5600e79e28e7737)

Robert Lyon (robertl-9)
no longer affects: mahara/15.10
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.