Editingteacher access to "unavailable" course

Editingteacher access to "unavailable" course

by Alan Zaitchik -
Number of replies: 2
What might be the problem why an editingteacher for a course has no access to a course that is not yet available to students? You may say, "how do you know that the person in question has that role?". The answer is that I use the query
SELECT c.visible,c.startdate,r.shortname,rc.contextid,rc.permission,rc.capability,u.username,c.shortname,ra.enrol FROM mdl_user u JOIN mdl_role_assignments ra ON ra.userid = u.id JOIN mdl_role r ON ra.roleid = r.id JOIN mdl_context con ON ra.contextid = con.id JOIN mdl_course c ON c.id = con.instanceid AND con.contextlevel = 50 JOIN mdl_role_capabilities rc ON r.id=rc.id where u.username='USERNAME' and c.shortname='COURSESHORTNAME';
and see that the person has a 'capability' of 'moodle/legacy:editingteacher' for this context. The permission is 1. The visible column is 0.
I am assigning roles through the external database plugin, not interactively/manually.
Thanks (and Happy New Year),
Alan

Average of ratings: -
In reply to Alan Zaitchik

Re: Editingteacher access to "unavailable" course

by Alan Zaitchik -
I should have added more explicitly that the courses are created automatically by the external db plugin based on a template course. I have set the template course so that it is not visible, and I have changed a line or two in /enrol/database/enrol.php so that the new autocreated courses use the visible setting of the template course. I have not overridden any roles in the template course, although I could if that is a solution.

I should perhaps also have added that the external database table returns 'editingteacher' as the value of the field mapped to the local role field (for instructors). I do not understand whether "legacy:editingteacher" is a problem or not... from other discussions I assumed it is not a problem.

All help most welcome!
In reply to Alan Zaitchik

Re: Editingteacher access to "unavailable" course

by Alan Zaitchik -
Further update. Please help!

Tim Hunt suggested I manually create an editingteacher account ('test001') and manually assign the editingteacher role to this account for the course in question. I did so but unfortunately this account was also unable to see the course after login!

I am attaching the XML output that shows both the new test account and the original instructor account are indeed editingteachers in the course. I have also determined through the course's administration ("Assign roles") interface that Moodle sees the two accounts as "Teachers (editing)" and that in general (Users>Permissions>Define Roles) the Teacher (editing) role has the capability "View hidden courses".

Has anyone experienced this with Moodle 1.9.3 Build 20081224? I am virtually certain that I did not have this problem with earlier releases/builds of 1.9.3. Is this possibly a bug in the 24 Dec build?

Thanks for any help.

Alan