Button Login As for teachers in 1.7

Button Login As for teachers in 1.7

by Miroslav Fikar -
Number of replies: 6
After upgrading Moodle to 1.7, some of our teachers started to complain about missing Login As button at the student's profile page. Digging into it we have found that the button still exists but only for admins. Therefore, at the site level context, we added capability loginas to teachers and the missing button is back.

However, now, any teacher can login in any role. It suffices for example to add Moodle Administrator account to list of students and Login As gives all administrator privileges and capabilities.

So, does anybody know the correct way of adding the button to lower privileges users?
Average of ratings: -
In reply to Miroslav Fikar

Re: Button Login As for teachers in 1.7

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Miroslav,

Have you noticed the "Switch role to..." button for teachers at the top right of the course page? This enables teachers to quickly access the student view of their course without the need to go to a particular student's profile page.
In reply to Helen Foster

Re: Button Login As for teachers in 1.7

by Miroslav Fikar -
Thanks Helen,
I am aware of that button. However, I am in a situation when it is needed to log in as a concrete student and not to see how it looks like in a student view. For example, if he/she needs some help from teacher or does not know how to do a concrete thing in Moodle.
Miroslav
In reply to Miroslav Fikar

Re: Button Login As for teachers in 1.7

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Sorry there doesn't seem to be any way to enable teachers to login as students only. As you've found, the user:loginas capability allows a user to login as any other user.
In reply to Helen Foster

Re: Button Login As for teachers in 1.7

by Viorel Tabara -
We ran into the same issue.
First of all the Admin is not required to be added to a course in order to have access to it.
While not a perfect solution this is a workaround we are looking at: create a group at the course level and add your teacher along with all the students to that group. Change the course settings "Group mode" to "Group mode:"=Separate groups" and "Force"="Yes" and the teacher won't be able to see the other participants.
This is the whole set of requirements:
[1]
* moodle17_test
* ► vtm17
* ► Edit course settings
"Group mode:"=Separate groups"
"Force"="Yes"
[2]
* moodle17_test
* ► vtm17
* ► Participants
* ► Groups
Create a group "LoginAsStudents"
Add the teacher and the students to that group.
[3]
For your "Teacher" role:
* moodle17_test
* ► Administration
* ► Users
* ► Permissions
* ► Define roles
moodle/site:accessallgroups = inherit/prevent
moodle/site:viewparticipants = inherit/prevent
moodle/user:viewdetails = allow
moodle/user:loginas = allow

Hope that helps,
Viorel
In reply to Viorel Tabara

Re: Button Login As for teachers in 1.7

by scott hallman -
Not a solution but rather experiencing the same problem. We have lost our log in as button altogether and it seems only to appear if we have created a manual account. Our users are loaded through ldap active directory. Does anyone know a way we can gain the log in feature back. Admin, and teachers can't do it. Admin needs to be able to log in as tutor and teachers as students. Apologies for not offering a solution. we are running 1.7 and this seems to be where the error started to occur
In reply to scott hallman

Re: Button Login As for teachers in 1.7

by Dean Thayer -
We had this problem in 1.8.2+ (2007021520) as well. I did a little digging in auth/ldap/auth.php and found that the call to $this->ldap_get_entries($ldapconnection, $user_info_result) at line 863 was returning no results. The reason for this appears to be that the call to $this->config->objectclass at line 859 does not get the right value. Both of these occur before the field mappings are checked to see if external updating is even required. I got around the problem by setting the "Object class" field in LDAP settings to "inetOrgPerson". Once I did that, it was smooth sailing.