Moodle

grous and pinned blocks don't have contexts, but get_child_contexts thinks they do

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.4
  • Fix Version/s: 1.9.5
  • Component/s: Roles / Access
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

function get_child_contexts($context) {
// ...
case CONTEXT_COURSE:
// ...
$sql = " SELECT ctx.*
FROM {context} ctx
WHERE ctx.path LIKE ?
AND ctx.contextlevel IN (".CONTEXT_MODULE.",".CONTEXT_BLOCK.")
UNION
SELECT ctx.*
FROM {context} ctx
JOIN {groups} g ON (ctx.instanceid=g.id AND ctx.contextlevel=".CONTEXT_GROUP.")
WHERE g.courseid=?
UNION
SELECT ctx.*
FROM {context} ctx
JOIN {block_pinned} b ON (ctx.instanceid=b.blockid AND ctx.contextlevel=".CONTEXT_BLOCK.")
WHERE b.pagetype='course-view'";

That is so wrong!

Activity

Hide
Tim Hunt added a comment -

Adding some of the usual suspects, in the hope that someone other than me will fix this

Show
Tim Hunt added a comment - Adding some of the usual suspects, in the hope that someone other than me will fix this
Hide
Tim Hunt added a comment -

Also function cleanup_contexts refers to CONTEXT_GROUP.

Show
Tim Hunt added a comment - Also function cleanup_contexts refers to CONTEXT_GROUP.
Hide
Petr Škoda (skodak) added a comment -

sure, feel free to remove it

Show
Petr Škoda (skodak) added a comment - sure, feel free to remove it
Hide
Petr Škoda (skodak) added a comment -

fixed

Show
Petr Škoda (skodak) added a comment - fixed
Hide
Mike Churchward added a comment -

I was just going to enter a new issue about the GROUP_CONTEXT not working when someone pointed me to this. We were actually playing with some new functionality that would allow roles to be assigned to group contexts.

Was there a reason to remove this?

Show
Mike Churchward added a comment - I was just going to enter a new issue about the GROUP_CONTEXT not working when someone pointed me to this. We were actually playing with some new functionality that would allow roles to be assigned to group contexts. Was there a reason to remove this?
Hide
Petr Škoda (skodak) added a comment -

Oh, groups context was never implemented in core. I was a mistake, please use standard group modes + other contexts instead.

Show
Petr Škoda (skodak) added a comment - Oh, groups context was never implemented in core. I was a mistake, please use standard group modes + other contexts instead.
Hide
Mike Churchward added a comment -

But we already have code that is using that context. Just because it wasn't used in core, doesn't mean it wasn't being used elsewhere.

Show
Mike Churchward added a comment - But we already have code that is using that context. Just because it wasn't used in core, doesn't mean it wasn't being used elsewhere.
Hide
Petr Škoda (skodak) added a comment -

Just because it was somewhere in main cvs doesn't mean it is supported. There are incomplete, buggy and highly experimental bits of code in many areas We should have removed it long ago, unfortunately we did not. I hope soon there will be 2.0 discussion related to future of roles, permissions, enrolments, parent roles, user profile roles and global groups. There are also known problems with groups at the course level, I suppose there will be some changes in this area too. If you want to use group contexts nobody prevents you from patching your installation, but it is not and never was supported in core. There is a chance that your modifications will not work in 2.0 at all, nobody knows yet. I personally hope we will simplify roles internals, solve majority of current problems and drastically improve performance in 2.0. We could revisit group contexts later, but I personally do not think it is a priority...

Show
Petr Škoda (skodak) added a comment - Just because it was somewhere in main cvs doesn't mean it is supported. There are incomplete, buggy and highly experimental bits of code in many areas We should have removed it long ago, unfortunately we did not. I hope soon there will be 2.0 discussion related to future of roles, permissions, enrolments, parent roles, user profile roles and global groups. There are also known problems with groups at the course level, I suppose there will be some changes in this area too. If you want to use group contexts nobody prevents you from patching your installation, but it is not and never was supported in core. There is a chance that your modifications will not work in 2.0 at all, nobody knows yet. I personally hope we will simplify roles internals, solve majority of current problems and drastically improve performance in 2.0. We could revisit group contexts later, but I personally do not think it is a priority...
Hide
Mike Churchward added a comment -

So why was it a priority to remove it? It wasn't causing any damage, just not being used by any core features.

Show
Mike Churchward added a comment - So why was it a priority to remove it? It wasn't causing any damage, just not being used by any core features.
Hide
Petr Škoda (skodak) added a comment -

The sooner we remove unsupported/broken bits the better IMO. The point was to prevent anybody using it and you are the proof we did that too late, not early. The damage of that code was that you started using it thinking it is something standard and supported which it was not at all

Show
Petr Škoda (skodak) added a comment - The sooner we remove unsupported/broken bits the better IMO. The point was to prevent anybody using it and you are the proof we did that too late, not early. The damage of that code was that you started using it thinking it is something standard and supported which it was not at all
Hide
Mike Churchward added a comment -

If something is broken, then you have a couple of options - fix it or remove it. I don't think GROUP_CONTEXT is an example of something that is broken (is it?).

If something isn't supported, I don't think you should remove it without first making sure that:
1. Nobody is using it, and if they are, they have time to plan for it.
2. There are no plans in the future for it.

Since, the roles, permissions, enrolments and parent roles are still issues up for discussion, how can you be sure that the GROUP_CONTEXT won't be part of that?

Show
Mike Churchward added a comment - If something is broken, then you have a couple of options - fix it or remove it. I don't think GROUP_CONTEXT is an example of something that is broken (is it?). If something isn't supported, I don't think you should remove it without first making sure that: 1. Nobody is using it, and if they are, they have time to plan for it. 2. There are no plans in the future for it. Since, the roles, permissions, enrolments and parent roles are still issues up for discussion, how can you be sure that the GROUP_CONTEXT won't be part of that?
Hide
Petr Škoda (skodak) added a comment -

In 1.9dev Martin Langhoff refactored all the group mess, unfortunately he was not part of the original group of people hacking roles before, so he just replaced the very broken bits with code that did something because he could not ask Yu who was not working with us any more.

Well, Martin Langhoff is working on different project now too, so from now on only me and Tim will be working on roles, enrolmnets and similar stuff. I was already bugfixing roles bugs in 1.7.x, 1.8.x and also regressions in 1.9.x This year I already spent more than a month thinking and redesigning the roles framework, unfortunately nobody wants to make the final decision - should we go ahead and do the radical changes? Also please note that after the 1.8x groups disaster I am now the only maintainer of groups code in core

1/ Did you read the docs?
see http://docs.moodle.org/en/Development:Roles
"Please note that CONTEXT_PERSONAL (present in 1.7-1.8) was never implemented and was removed in 1.9. CONTEXT_GROUP is also not implemented and **can not** be used. "

2/ Did you publish your code anywhere?
Before removing I did search in contrib, moodle.org forums and also tracker and did not find anything using CONTEXT_GROUP. One of the main benefits of putting code into contrib or reporting issues into tracker is that developers can see what you are doing with the core code. How am I supposed to know you are using some weird code that was never meant to be used? Yes, I can post in moodle.org forums and wait a few days before I get some answers, but very often people overlook these requests or are not subsribed to those forums at all

Show
Petr Škoda (skodak) added a comment - In 1.9dev Martin Langhoff refactored all the group mess, unfortunately he was not part of the original group of people hacking roles before, so he just replaced the very broken bits with code that did something because he could not ask Yu who was not working with us any more. Well, Martin Langhoff is working on different project now too, so from now on only me and Tim will be working on roles, enrolmnets and similar stuff. I was already bugfixing roles bugs in 1.7.x, 1.8.x and also regressions in 1.9.x This year I already spent more than a month thinking and redesigning the roles framework, unfortunately nobody wants to make the final decision - should we go ahead and do the radical changes? Also please note that after the 1.8x groups disaster I am now the only maintainer of groups code in core 1/ Did you read the docs? see http://docs.moodle.org/en/Development:Roles "Please note that CONTEXT_PERSONAL (present in 1.7-1.8) was never implemented and was removed in 1.9. CONTEXT_GROUP is also not implemented and **can not** be used. " 2/ Did you publish your code anywhere? Before removing I did search in contrib, moodle.org forums and also tracker and did not find anything using CONTEXT_GROUP. One of the main benefits of putting code into contrib or reporting issues into tracker is that developers can see what you are doing with the core code. How am I supposed to know you are using some weird code that was never meant to be used? Yes, I can post in moodle.org forums and wait a few days before I get some answers, but very often people overlook these requests or are not subsribed to those forums at all
Hide
Mike Churchward added a comment -

I read the docs. recently. Not sure when that comment was added...

I can't publish my code, because it isn't complete - and now has a serious barrier to overcome. But, keep in mind there are many Moodle partners who develop code where we would rather not keep our own versions so that clients can update easier.

On the same note, maybe you could comment on http://moodle.org/mod/forum/discuss.php?d=111362 ? That is a request to expand contexts so that external additions can add their own. If we go that route, these issues can be solvable. We have ideas on how these could be maintained and controlled, but need buy-in first.

Show
Mike Churchward added a comment - I read the docs. recently. Not sure when that comment was added... I can't publish my code, because it isn't complete - and now has a serious barrier to overcome. But, keep in mind there are many Moodle partners who develop code where we would rather not keep our own versions so that clients can update easier. On the same note, maybe you could comment on http://moodle.org/mod/forum/discuss.php?d=111362 ? That is a request to expand contexts so that external additions can add their own. If we go that route, these issues can be solvable. We have ideas on how these could be maintained and controlled, but need buy-in first.
Hide
Petr Škoda (skodak) added a comment -

Revision: 20:35, 2007 December 23 http://docs.moodle.org/en/index.php?title=Development%3ARoles&diff=30641&oldid=28165
replying in forum now

Show
Petr Škoda (skodak) added a comment - Revision: 20:35, 2007 December 23 http://docs.moodle.org/en/index.php?title=Development%3ARoles&diff=30641&oldid=28165 replying in forum now

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: