Companion account

Authentication ::: auth_companion
Maintained by Andreas Grabs
The Moodle plugin auth_companion gives teachers the possibility to log in with a companion account. This will enable them to view and review a course from a participant's perspective.
Latest release:
121 sites
129 downloads
26 fans
Current versions available: 3

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.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5

Contributors

Andreas Grabs (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Plugins bot
    Thu, 8 Dec 2022, 4:01 PM
    Approval issue created: CONTRIB-9158
  • Ricardo Caiado
    Fri, 3 Feb 2023, 7:57 AM
    Hi,

    Can I take a quiz using this plugin?

    Ricardo
  • Andreas Grabs
    Fri, 3 Feb 2023, 2:28 PM
    Hi 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
  • Ricardo Caiado
    Fri, 3 Feb 2023, 8:07 PM
    Hi, Andreas.

    Thanks for the reply.

    Under which username this new account is created?

    Ricardo
  • Andreas Grabs
    Fri, 3 Feb 2023, 8:26 PM
    The username is a randomly generated unique name. It does not matter for the usage. Nobody except the admin can see this name.
    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.
  • Dag Klimas
    Sun, 5 Feb 2023, 8:27 PM
    Thank you, Andreas, for another great plugin.
  • Ricardo Caiado
    Sun, 5 Feb 2023, 9:17 PM
    Andreas,

    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
  • Andreas Grabs
    Mon, 6 Feb 2023, 12:57 AM
    Hi 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
  • Ricardo Caiado
    Tue, 7 Feb 2023, 10:03 PM
    Andreas,

    Thanks for the info.

    Ricardo
  • Przemek Kaszubski
    Sat, 3 June 2023, 7:24 PM
    Just started testing the plugin under Moodle 4.0. Some questions / maybe suggestions?

    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.
  • Przemek Kaszubski
    Sat, 3 June 2023, 8:52 PM
    4) Perhaps one other suggestion I'd have would be for when the admin decides to leave data deletion up to the user: There should be, I think, a clearer and fairly dramatic warning that this will not just delete the user data in the current course, but:
    - 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
  • Susanna Wesson
    Mon, 14 Apr 2025, 6:03 AM
    Thanks for this useful plugin. I cannot add the companion student to groups created using Cohort sync, at least, when I add companion student to a group, it will not stay there. I wonder xhy?
Please login to post comments