Moodle Plugins directory: Companion account | Moodle.org
Companion account
Companion account
As a teacher, you would like to view and test your course from a participant's perspective.
Unfortunately, the standard method via "Switch role to" does not always bring the desired result.
With the companion account you have the possibility to temporarily switch to a student account.
With this student account you can test the course just as if you were a real student.
Installation
Copy all files into the folder auth/companion inside your moodle installation. Run the installation process in moodle. You can find more detailes to the installation process here: https://docs.moodle.org/en/Installing_plugins#Installing_a_plugin
Settings
Before you can use this plugin, you must enable the "companion" authentication method. In the settings you can define a suffix that will be attached to the companion account. If you need increased security, you can enable "forcelogin" in the plugin settings. With this a new login will be requested after each change to the origin account.
Usage
If you are a teacher and you are on a course page, you will find a new entry Switch to companion in the user menu.
To switch back you will find the entry Switch back at the same place.
Can I take a quiz using this plugin?
Ricardo
yes, this plugin creates a real temporary account. You can take quizzes or do other stuff students can do in a course.
If you don't delete the data after switching back, you can even see the grading. Or you do an additional Login in another browser, then you can use both in parallel.
I hope this helps a little.
Best regards
Andreas
Thanks for the reply.
Under which username this new account is created?
Ricardo
Note: You cannot log in directly with the Companion Account. To switch to this account you have to select "Switch to companion" in the user menu.
I am admin of a Moodle installation with 370k+ users.
The usernames we create follow a formation law. Thus, it is easy to identify a legitimate account from an account generated due to a hack.
How to differentiate a username created by your plugin from a username created by a hacker?
Another question: can only the user who created this username remove the data generated from this username?
If he creates this username and does not delete the data after using it, this information will be stored in the database even if he does not access it again. Over time, unused information will accumulate in the database.
Ricardo
the usernames are created uniquely using a uuid.
To distinguish companion accounts from other accounts, you can check the authentication method of these accounts. A companion account always has the "companion" method as its authentication method. Such an account cannot be created in any other way, except by the system administrator, of course.
The companion account remains until the user deletes it or, as a privacy request, has its data deleted.
If a user account is deleted, the companion account is also automatically deleted.
Best regards
Andreas
Thanks for the info.
Ricardo
1) I think the teacher should see a sticky label or warning that they are using a companion account - more or less as is the case with the "Switch role" > "Student" etc. pill displaying permanently
2) It would be great if the "Switch to companion" menu item could be placed inside or next to the "Switch roles" option. Teachers may find it confusing to see both options, and separated from one another.
3) I haven't looked deeper, I admit, but is there a capability associated with this function, so only some users could be permitted to use it?
Thanks for this plugin. I hope we'll be able to help our teachers and course testers - really useful especially when only external authentications are set on a site, and normal users cannot be easily given duplicate accounts for testing.
- delete the user data (in this course and in any other courses where the users] has been using this companion account)
- unenrol this companion account from this course
- unenrol this companion for any other courses
- plus actually delete this account entirely from the Moodle system -
so that when we switch to a companion again, it will be a fresh new test account.
Probably all this info can be compressed, but I'm finding it crucial for how a teacher might want to actually plan effective use of a test / companion account.
It would seem that at this point it's probably best / administratively most convenient to keep the default uth_companion | forcedeletedata value of Yes - to avoid confusion. I can then simply tell the users - when you switch back, that companion account is gone / reset etc.
HTH. Kind regards, Przemek