Allow grouproles to be reset for account holders when roles updated via webservices

Bug #1871280 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned
20.04
Fix Released
Medium
Unassigned
20.10
Fix Released
Medium
Unassigned

Bug Description

When creating new groups via webservices while the user is logged in.

The "group/find.php" search works with a user's grouproles and when a group is created via webservice the grouproles are not reset for the session. So only after the user logged out and logged in again, the group is found with "group/find.php".

We need to set a flag so that when a person loads anything in mahara (eg calls the $user->renew() function) that it resets the group roles for the user so they don't have to logout and login again.

Added from discussion with Robert (2020-05-08):
The group_add_user() and group_remove_user() functions already call the $USER->reset_grouproles() function - so this patch is only fixing the problem when group_create() is called. In 'normal' Mahara we can't create a group with more than the current user, but via webservice we can create a group with many members at once and that causes this problem.

Robert Lyon (robertl-9)
Changed in mahara:
importance: Undecided → Wishlist
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/10864

Revision history for this message
Robert Lyon (robertl-9) wrote : Re: Allow grouproles to be reset for users when roles updated via webservices
Rangi Daymond (rangid)
description: updated
Revision history for this message
Robert Lyon (robertl-9) wrote : Re: Allow grouproles to be reset for users when roles updated via webservices

This problem doesn't exist in master / 20.04 as there were two related changes there that fixed this problem

As one of the changes was done in 19.10 we will add the other fix there to sort the problem - will make a new patch for that

The fix in patch 10864 will sort out the problem for mahara 19.04 if anyone needs it - but we will not merge into 19.04 branch as it would be a wishlist item there - new code rather than fixing existing code.

Changed in mahara:
importance: Wishlist → Medium
Revision history for this message
Robert Lyon (robertl-9) wrote :

Actually there is a fix for 20.04+ as well that is different to the 19.10 one

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

Patch for "19.10_STABLE" branch: https://reviews.mahara.org/10965

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

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

Revision history for this message
Rangi Daymond (rangid) wrote : Re: Allow grouproles to be reset for users when roles updated via webservices

Catalyst QA Testing: patch for master - PASSED

Gerrit: https://reviews.mahara.org/#/c/10966/ patch 2
 Bug 1871280: Using correct search with 'Groups I am in' during pagination

Pre-requisites:
a) Site admin creates 12 controlled groups with names prefixed AAGroup, ABGroup, ACGroup, ... ALGroup.
b) Person1 is a member of the first 11 groups AAGroup thru AKGroup.
c) Person2 is not a member of any group.

Steps:
1. Apply patch to master.
2. Log in as site admin and:
   - add two non-admin target users (check database id=2 and id=3)
   - navigate to the Groups home page, note the groups displayed with default 'All my groups' filter set.
3. For each user (id=2 and id=3) in another private/incognito browser window:
   - log in with the target user
   - navigate to the Groups homepage, note the groups displayed with default 'All my groups' filter set
   - Search using the 'Groups I am in' filter, the groups displayed should be the same as previous step.
4. To add more than one user on group creation (simulate web service response) , edit the htdocs/group/edit.php file and change the following line (about line 560+) from:
 $newvalues['members'] = array($USER->get('id') => 'admin');
to:
 $newvalues['members'] = array($USER->get('id') => 'admin', 2 => 'member', 3 => 'member');
5. With the logged in admin user:
   - create a new group named BAGroup.
Expected results:
   - ✔ the new group's home page displays with three members listed (scroll down)
   - navigate to the Groups home page:
     * ✔ there are 2 pages to display 13 groups (default 10 per page)
     * ✔ the new group is displayed at the end of the second page
     * ✔ the group filters display the correct results (no change to functionality).
6. In each of Person1 & Person2's browser windows, check the Search filter results.
Expected results:
   The newly created group is correctly displayed in the results for:
   - All my groups: ✔Person1 12 (new group on second page) & ✔ Person2 1 (single page)
   - Groups I'm in: ✔ Person1 12 (new group on second page) & ✔ Person2 1 (single page)
   - All groups: ✔ both 13 (new group on second page).
   The newly created group is correctly NOT displayed in the results for:
   - Groups I own: ✔ both none
   - Groups I'm invited to: ✔ both none
   - Groups I can join: ✔ both none
   - Groups I'm not in: ✔ Person1 1 (single page) & ✔ Person2 12 (two pages).

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

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

commit a357f8cc471af8513cee130cc7580b9c753fa04a
Author: Robert Lyon <email address hidden>
Date: Fri May 8 16:21:26 2020 +1200

Bug 1871280: Using correct search with 'Groups I am in' during pagination

Change-Id: I7f2f80c350ba45dfdf2953eac193188c57f27c2c
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 "20.04_STABLE" branch: https://reviews.mahara.org/10978

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

Reviewed: https://reviews.mahara.org/10978
Committed: https://git.mahara.org/mahara/mahara/commit/5c7ff29d6d7f3bff74853f1592ebf9363612cc77
Submitter: Robert Lyon (<email address hidden>)
Branch: 20.04_STABLE

commit 5c7ff29d6d7f3bff74853f1592ebf9363612cc77
Author: Robert Lyon <email address hidden>
Date: Fri May 8 16:21:26 2020 +1200

Bug 1871280: Using correct search with 'Groups I am in' during pagination

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

no longer affects: mahara/19.04
no longer affects: mahara/19.10
summary: - Allow grouproles to be reset for users when roles updated via
+ Allow grouproles to be reset for account holders when roles updated via
webservices
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 20.10.0 → none
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.