Current loginas can non IMHO work as expected now, because you can not always override your own capabilitites in subcontext - this makes it not usable for users with some administration capability assigned at the system level
This feature should IMO work for admins and should emulate REAL user login but without the need for password, it should not be used by ordinary teachers. Teachers should use switch role only.
1/ define loginas capability in system context only
2/ fix the code to fully switch the $USER and load all capabilities
time needed: cca 4 hours for coding and testing