Issue Details (XML | Word | Printable)

Key: MDL-20471
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: moodle.com
Reporter: Daniel Neis
Votes: 0
Watchers: 6
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Role unassign doesn't remove users from groups if contextlevel != course

Created: 07/Oct/09 09:43 PM   Updated: 07/Dec/09 06:44 PM
Component/s: Roles
Affects Version/s: 1.9.5, 1.9.6
Fix Version/s: None

File Attachments: 1. File ra_groups_remove.diff (2 kB)
2. File ra_groups_remove_v2.diff (2 kB)


Participants: Anthony Borrow, Daniel Neis and moodle.com
Security Level: None
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
As posted on development forum (http://moodle.org/mod/forum/discuss.php?d=134417) , the function role_unassign only check for group membership if the contextlevel is the course.
I am posting a patch that do this job for every contextlevel < COURSE , and finds all the child contexts, iterates over them and in the course ones checks the capability and do the group membership removal.
Hope you like.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Daniel Neis added a comment - 08/Oct/09 03:00 AM
This second patch (ra_groups_remove_v2.diff) should be applied instead of the first one, cause it tests if context_childs is really an array, avoiding php warnings

Anthony Borrow added a comment - 08/Oct/09 02:43 PM
Nicolas - Here is another patch from Daniel which I thought might be helpful to look at before 1.9.6. It looked like you had looked at one of his other patches regarding something similar; however, I understand if you do not have time. Daniel asked if I would help ensure that it at least received a quick glance before 1.9.6. I looked at the patch and it did seem to have a typo in the foreach line.

+ if (!$child_contexts = get_child_contexts($context)) {
+ foreach ($childe_contexts as $cc) {

I suspect it should be

+ foreach ($child_contexts as $cc) {

Peace - Anthony


Daniel Neis added a comment - 09/Oct/09 01:45 AM
Hello, Anthony

thanks for the attention and for schedule it for 1.9.6 , and sorry for the typo.

=O)


Anthony Borrow added a comment - 09/Oct/09 02:56 AM
Daniel - Actually I will let Nicolas make the determination whether to change the Fix version to 1.9.6 but I am happy to give this a little bump as the more little things we can clean up for 1.9.6 the better. Peace - Anthony

Daniel Neis added a comment - 28/Oct/09 08:50 PM
Hello,

is someone looking at this yet?
I did some more tests and that condition before the foreach mentioned by Anthony has no sense.
So, we must remove the " IF ! " condition and just take the child contexts.


Daniel Neis added a comment - 07/Dec/09 06:42 PM
Hello, Eloy and Petr

i am adding you as watchers, because i don't have find a leader of "course module", so if you can take a look at this, i will be really happy.
Thanks.


Daniel Neis added a comment - 07/Dec/09 06:44 PM
sorry, the maintainer should be the one for "roles" instead of "course", but i think there is no one too.