I would like to duplicate some users in Moodle. It means these users must preserve the same information of the original users (personal data, enrolments, roles, rights, etc.). Only two information should be different: the Username and the Email address. The accounts have the Shibboleth authentication method. How could I duplicate the users?
I can't think of any way to do that. It's a very unusual request.
Unfortunately this is the request of my client, because there are a lot of users that worked for the xxx company and now work for the yyy company. This means their emails "@xxx.it" has been replaced with "@yyy.it". And the same for the Username that is equal to the email, beacause it's synchronized with the upn in AD(Active Directory). The "@xxx.it" account will be removed in AD and they'll use only the "@yyy.it" account now.
Script something to change the username and email directly in the database? Creating duplicate accounts would be well down my list of possible solutions for that problem.
Let's say you have success, for example Alissio.xxx.it, and Alissio.yyy.it. Then what? What do you hope to accomplish? Incidentally, I don't know about the Shibboleth authentication method, so if my question is off target, ignore it.
Since users are available in AD, Use OAUTH2 with myname@yyy.it
- Go to Site admin > Users > Bulk User Actions.
- Filter on email contains xxx.it
- Download those users that a spreadsheet
In the spreadsheet…
- Rename the username column to “oldusername”
- Correct the email addresses using search and replace
- Copy that email column to a new column and call that “Username”
If they are still using the same authentication method, that all you need to do with the spreadsheet. If not, you can add a column for “auth” too and change that for each person if needed.
Back in Moodle,
- Go to Site admin > Users > Upload users
- Select “Update existing users only” and “Override with file”
- Upload
The whole process should take you less than 10 minutes
Is it possible to include an "or condition" in the "Bulk User Actions"? For example, I would like to filter by searching a list of usernames (ex. username1@xxx.it, username2@xxx.it and so on) and not all the users with username "@xxx.it".
No - but the easiest solution is to filter in Moodle on all your @xxx.it addresses and download all of them, and then do your more detailed filtering in Excel.