Changing the file quota for users in an institution, can send notifications to users in other institutions

Bug #1606094 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Aaron Wells
15.04
Fix Released
High
Aaron Wells
15.10
Fix Released
High
Aaron Wells
16.04
Fix Released
High
Aaron Wells
16.10
Fix Released
High
Aaron Wells

Bug Description

On the institution config screen, there's a setting called "Update user quotas" that will do a one-time application of the institution's current "default quota" value to all existing users of the institution. At the same time, if you're using the "quota almost exceeded" notification emails, it will check each user whose quota has just been changed and send them a notification if they're near the threshold.

The first part of this works fine. It does indeed update the quota for members of the changed institution, and nobody else. But there's a bug in the second part, that sends out the notifications. Instead of only checking the users in the institution, it checks *every* user in the site, and sends a notification to any of them who are near the threshold for the changed institution. This is not only annoying to users who aren't in the institution, but also confusing, because the email will tell them that their quota is the size of the changed institution's quota, when in fact their quota has not changed.

To replicate:

1. Clean Mahara install
2. Log in as admin
3. Upload a 1MB file into your File -> Contents area
4. Create an institution. Save the institution.
5. Click the "edit" link for the institution.
6. Set "Default quota" to 100 Kilobytes.
7. Set "Update user quotas" to "On"
8. Click "Submit"

Expected result: The admin user should not receive a notification, because they're not in that institution and their quota has not changed.

Actual result: The admin user receives a notification about being over their quota, but their quota has not actually changed from the default 50MB.

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/6748

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

Reviewed: https://reviews.mahara.org/6748
Committed: https://git.mahara.org/mahara/mahara/commit/2c262cdf8d3ddb8c9c66565c084b67e2f24825e6
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 2c262cdf8d3ddb8c9c66565c084b67e2f24825e6
Author: Aaron Wells <email address hidden>
Date: Mon Jul 25 13:46:14 2016 +1200

Bug 1606094: Stop sending quota notifications to everyone

This patch changes that bad left (outer) join to an inner
join, so that we only check for notifications for users
who are in the affected institution.

As a further safeguard, it also removes the line that
compared each user's file usage to the institution's
new quota. Now, we'll instead compare each user's
file usage to that user's current quota (which, for
members of the institution, will be the institution's
new quota.)

Change-Id: I4db6068221d1238c8a755434e78e6cc006a84aa8
behatnotneeded: Test to come later

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

Patch for "16.04_STABLE" branch: https://reviews.mahara.org/6772

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

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6773

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

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

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

Reviewed: https://reviews.mahara.org/6774
Committed: https://git.mahara.org/mahara/mahara/commit/01bf95d5cbda7bb642b695d5ddab39bac2b3d47d
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 01bf95d5cbda7bb642b695d5ddab39bac2b3d47d
Author: Aaron Wells <email address hidden>
Date: Mon Jul 25 13:46:14 2016 +1200

Bug 1606094: Stop sending quota notifications to everyone

This patch changes that bad left (outer) join to an inner
join, so that we only check for notifications for users
who are in the affected institution.

As a further safeguard, it also removes the line that
compared each user's file usage to the institution's
new quota. Now, we'll instead compare each user's
file usage to that user's current quota (which, for
members of the institution, will be the institution's
new quota.)

Change-Id: I4db6068221d1238c8a755434e78e6cc006a84aa8
behatnotneeded: Test to come later
(cherry picked from commit 2c262cdf8d3ddb8c9c66565c084b67e2f24825e6)

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

Reviewed: https://reviews.mahara.org/6772
Committed: https://git.mahara.org/mahara/mahara/commit/7e05f9aafe6a947dc0765de604aef63071ae238b
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit 7e05f9aafe6a947dc0765de604aef63071ae238b
Author: Aaron Wells <email address hidden>
Date: Mon Jul 25 13:46:14 2016 +1200

Bug 1606094: Stop sending quota notifications to everyone

This patch changes that bad left (outer) join to an inner
join, so that we only check for notifications for users
who are in the affected institution.

As a further safeguard, it also removes the line that
compared each user's file usage to the institution's
new quota. Now, we'll instead compare each user's
file usage to that user's current quota (which, for
members of the institution, will be the institution's
new quota.)

Change-Id: I4db6068221d1238c8a755434e78e6cc006a84aa8
behatnotneeded: Test to come later
(cherry picked from commit 2c262cdf8d3ddb8c9c66565c084b67e2f24825e6)

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

Reviewed: https://reviews.mahara.org/6773
Committed: https://git.mahara.org/mahara/mahara/commit/d2c729330e0f7842445d92f489366b2174c6b2d5
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit d2c729330e0f7842445d92f489366b2174c6b2d5
Author: Aaron Wells <email address hidden>
Date: Mon Jul 25 13:46:14 2016 +1200

Bug 1606094: Stop sending quota notifications to everyone

This patch changes that bad left (outer) join to an inner
join, so that we only check for notifications for users
who are in the affected institution.

As a further safeguard, it also removes the line that
compared each user's file usage to the institution's
new quota. Now, we'll instead compare each user's
file usage to that user's current quota (which, for
members of the institution, will be the institution's
new quota.)

Change-Id: I4db6068221d1238c8a755434e78e6cc006a84aa8
behatnotneeded: Test to come later
(cherry picked from commit 2c262cdf8d3ddb8c9c66565c084b67e2f24825e6)

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Thank you to SWITCH Information Technology Services in Switzerland for reporting this bug.

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → none
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.