|
Jeff Wood found the solution to this:
Site Administration > Users > Permissions > Define roles Teacher Role - Edit - Course area Change moodle/course:viewhiddencourses from inherit to allow Jenny What I can't understand is that from my read of the capabilites system the teacher role should allow this by default:
'moodle/user:viewhiddendetails' => array( 'riskbitmask' => RISK_PERSONAL, 'captype' => 'read', Dan, you did the wrong copy/paste... Correct is around line 515:
'moodle/course:viewhiddencourses' => array( 'captype' => 'read', BUGFIX:
If you execute this SQL query: INSERT INTO `mdl_role_capabilities` ( `id` , `contextid` , `roleid` , `capability` , `permission` , `timemodified` , `modifierid` ) The problem seems to be solved (at least on my install). If you want to show the course to editing teachers only, then substitute '2' for the '3'. I have a problem making a proper patch out of this though. If some kind soul answered the questions at http://moodle.org/mod/forum/discuss.php?d=65584 I have also confirmed this behaviour in my install - Moodle 1.7.1+ (2006101010).
I made several attempts to test, reproduce and overcome this issue:
Since I manage a Moodle site with this version and it's already being used by students at my university the matter became rather urgent. Giving administration privileges to all teachers that had courses to prepare was clearly not an option. I decided to look in the code and try my best to find a potential solution. Notice: I do not claim this to be a good solution. I'm NOT a Moodle expert, far from it I commented all insertions and modifications in the code. I left all previous functionality untouched. Forgive me if I do not follow Moodle coding conventions. Feel free to try this patch at your own risk Proposed patch PATCH:
if ($parent === 'none') {
$categories = get_records('course_categories', '', '', $sort);
} else {
$categories = get_records('course_categories', 'parent', $parent, $sort);
} \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1, $files = true) { ...... (Line: 1351) \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Proposed Patch usage instructions:
For the patch that I described in my previous post to work I suggest that you: 1) create or modify a role that has the permissions:
2) Assign that Role to the users that should see hidden categories and courses IN THE LEVEL from which they should see them. Example:
Considering that you created a role called SeeHidden with the above permissions set to allow the possible scenarios are: b) you want the user to see onlu Course2 c) you want the user to see Course3 I hope this helps. André Hi, this is fixed in 1.7, 1.8 and 1.9. All new installs and upgrades will enable teachers, non-editting teachers and course creators to see respective hidden courses by default. However we can not change that for any existing installations. To fix this you just need to log in as admin, go to users->permission->define role and set viewhiddencourses to allow for all these roles. Cheers.
Any clues as to what files/folders I should upgrade to fix this in my 1.7 install? When I go to users->permission->define roles I do not have a viewhiddencourses option, so it seems I can not fix it this way.
Thanks in advance. Hi Yu,
Thanks for the fast response, however I don't have any moodle/course permissions in my mdl_capabilities db table, so they are not appearing on the page. Strangely, my auto-increment keys in mdl_capabilities start from 78, so it looks like I am missing a whole bunch of permissions in this table. I think I have found what they are meant to be (documented in lib/db/access.php), but I'm not sure how to load them in to the table quickly. I'll look in to it. I might need to do a fresh install of 1.7 and see what data I'm missing. Thanks for your help Jess Yes, I was missing a lot of permissions in my mdl_capabilities table. Not sure what happened in the upgrade process from 1.5>1.7, but I was missing all the fields from rows 1-77. To fix this, I did a fresh install of the latest 1.7 STABLE release on my development server, backed up the data in the mdl_capabilities table and restored the table on my live server. I now have access to a whole lot of other permissions when I go to users->permission->define roles. It appears to have fixed many of the permission errors the teachers were experiencing. What a relief!
Thanks for your help Yu. Jess I've got version 1.7.3. I've changed the roles so that viewhiddencourses is Allowed (and viewhiddencategories since the hidden courses are in a hidden category). However teachers still cannot view the coruse in question. Any ideas what else I can do to fix this?
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Admins can see hidden course and teachers cannot.
Jeff