Moodle Switch Roles Tool
Moodle has a feature called “switch role” which allows users with enough access to choose other legacy roles (the Moodle default roles) and to view the site from the point of view of these other roles.
Basics of Switching Roles
The switch roles function allows a user with the capability moodle/role:switchroles to switch their view to that of another role. Switching to such a role is performed through a pull-down menu in the upper right corner of Moodle which is visible only to those with the capability.
Switching Roles in Depth
Moodle documentation states: "New roles may not be tested using the “Switch role to…” feature." By this, it seems to imply that in actuality only the Teacher, Non-editing Teacher, Student, and Guest can accurately be tested with switch as others may include capabilities not properly reassigned when switching.
Q: Why doesn’t “Switch role to..” within a course seem to work properly for a Course Creator? A: This feature is intended for Teachers assigned at the course level. Users assigned at “higher” contexts should not expect reliable results from this function. * —Moodle FAQ*
Because of added capabilities for the Course Creator and Administrator roles, when changing capabilities and then reassigning them through Switch, they may not all carry over correctly. Petr Skoda writes: “We should not allow admin to switch roles, because it can not work properly and also document the potential problems when user has other roles assigned above the course context because they might produce unexpected results.” (MDL-8841 & tracker.moodle.org) Some examples of where get load_all_capabilitites() fails to switch over correctly from admin: Activity Report, Restrict Activity Modules, and Assign Roles control.