Error on registration if confirmed registration is turned on and copy collection in play

Bug #1367939 reported by Robert Lyon on 2014-09-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Robert Lyon
1.7
High
Robert Lyon
1.8
High
Robert Lyon
1.9
High
Robert Lyon

Bug Description

If you have an institution with:
- both "Registration allowed" and "Confirm registration" chosen in it's config.
- a collection that has the "Copy for new institution members" checked (under Admin -> Institution -> Share -> [name of collection] -> Advanced options)

When a new user registers the admin gets an email to approve them, and on approval, the new user gets an email to complete signup.

When the user clicks the complete signup link we get an error like:

[WAR] 5f (lib/view.php:503) View::_create: User 0 is not allowed to create a view for owner 13
Call stack (most recent first):

    View::_create(array(size 5), 0) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/view.php:371
    View::create_from_template(array(size 5), "18", 0, false, true) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/collection.php:274
    Collection::create_from_template(array(size 1), "2", null, false, true) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/auth/user.php:1302
    User->copy_institution_views_collections_to_new_member("squid") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/institution.php:338
    Institution->addUserAsMember(object(User)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/auth/user.php:683
    User->join_institution("squid") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/register.php:150
    create_registered_user() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/register.php:198

The problem being the system doesn't 'know' who is the authority user giving permission for this new user to copy the collection and so tries to do it with guest user (userid = 0).

We need to have a way of either working out who the authority user id would be - or ignore it in this particular case (if safe to do)

Reviewed: https://reviews.mahara.org/3691
Committed: http://gitorious.org/mahara/mahara/commit/69041d9e60de31b73ba0c18efc22cfa47598ef63
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 69041d9e60de31b73ba0c18efc22cfa47598ef63
Author: Robert Lyon <email address hidden>
Date: Thu Sep 11 10:47:05 2014 +1200

Register confirm allow user to copy collection (Bug #1367939)

See bug for testing

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

Robert Lyon (robertl-9) on 2014-09-16
Changed in mahara:
status: In Progress → Fix Committed

Reviewed: https://reviews.mahara.org/3701
Committed: http://gitorious.org/mahara/mahara/commit/87ddefc271675251138de306c533fb62a12ff8e2
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.9_STABLE

commit 87ddefc271675251138de306c533fb62a12ff8e2
Author: Robert Lyon <email address hidden>
Date: Thu Sep 11 10:47:05 2014 +1200

Register confirm allow user to copy collection (Bug #1367939)

See bug for testing

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

Mahara Bot (dev-mahara) wrote :

Patch for "1.7_STABLE" branch: https://reviews.mahara.org/3703

Jinelle Foley-Barnes (jinelleb) wrote :

Hi,

I couldn't replicate this bug. It worked perfectly when I tried.

The steps I tried were:

-Log in as admin
-Click Administration
-Institutions
-Add institution
-Added "test" institution
-Checked Registration Allowed
-Checked Confim Registration
-Submit
-Pages
-Create a page
-Filled in default fields with "test"
-Save
-Done
-Collections
-Add one
-Typed in name and description with "test"
-Next: Edit collection pages
-Checked the boxes of pages to add
-Add pages
-Done
-Home logo
-Administration
-Institutions
-Share
-Edit acces (key img)
-Advanced options drop down
-Check Allow copying
-OK
-Logout
-Register
-Entered first and last name and email
-Set institution to "my test one"
-Typed anything in registration reason
-Register
-Checked emails and clicked link in emails
-Sign in as Admin
-Click Approve
-Go back to emails and click the new link
-Brought up password change form, so changed password
-Click Submit
-Password saved successfully

Thanks,
Jinelle

Jinelle Foley-Barnes (jinelleb) wrote :

* Sorry, on 1.8

Robert Lyon (robertl-9) wrote :

Did you also check the 'Copy for new users' option when on step for 'Check Allow copying'?

The error is when it tries to copy the collection pages to the new user on user creation.

Sorry I couldn't edit my previous comment, but yes I did .

 About to try on the 1.7 branch too.

Hi,

The patch for 1.7 was successful as well.

Cheers,
Jinelle

Reviewed: https://reviews.mahara.org/3703
Committed: http://gitorious.org/mahara/mahara/commit/8be59162bf87df0872d0f4ad0870fade0a4c8f5e
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.7_STABLE

commit 8be59162bf87df0872d0f4ad0870fade0a4c8f5e
Author: Robert Lyon <email address hidden>
Date: Thu Sep 11 10:47:05 2014 +1200

Register confirm allow user to copy collection (Bug #1367939)

See bug for testing

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

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3702
Committed: http://gitorious.org/mahara/mahara/commit/3fdb6816585bd2159735e502fbbb2216a7498e77
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.8_STABLE

commit 3fdb6816585bd2159735e502fbbb2216a7498e77
Author: Robert Lyon <email address hidden>
Date: Thu Sep 11 10:47:05 2014 +1200

Register confirm allow user to copy collection (Bug #1367939)

See bug for testing

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

Robert Lyon (robertl-9) on 2014-11-02
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers