Duplicated Moodle accounts

Duplicated Moodle accounts

napisao/la Otaku Dude -
Number of replies: 13

Hi all,

Our accounts are scripted and we import new users via a csv. For some reason I am seeing dozens of duplicated accounts, one that I can edit and one that I can't (the edit profile link is missing when I click the account users name). Our scripts run with a cumulative list of users but skips those it has already made an account for. I've not seen this before and I'm not quite sure where to start. We don't allow accounts with the same email (LDAP setting), but the duplicated ones do have the same emails address.

Enrol

Our script meta-links a user to a course and it's the users with Deny Access that have been meta linked. When these uses log into Moodle is the other account that is used, but with no meta lining. I have checked the csv.s and they only have one instance of each user.

Moodle 3.9.1

Theme: Adaptable

Thank you in advance,

Nige.


Prosjek ocjena: -
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hi,

Looking at this today, I noticed that there are lots of accounts that I can't now look at the edit profile page, and they are not duplicates. They all have the Deny Access/Allow status under edit. Iv'e never seen this before in Moodle. Anyone have any idea what this means on an account listing? I want to get in the profile page and see what the auth has been set to. I suspect it's manual (which we never use).

Thank you,

Nige.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Ken Task -
Slika Particularly helpful Moodlers

Think the only way to get a true assessment of the users on your moodle is to query the mdl_user table with a DB client.

If accounts expire, Moodle obscures the viewing of those accounts via any GUI interface to users.

Example: username (which is used to login) becomes users email address and added to that data a 'dot' + epoch time stamp of the date account became inactive/accessible.  Email address becomes a hash.

Looks like the following from client:

id auth username firstname lastname email
12196    ldap    harry.potter@stu.someschool.org.1538492470    Harry    Potter 7a20ef653345a9238677c16ac4949c49

'SoS', Ken


In reply to Ken Task

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hi Ken,

Thank you for your response. Looking at the duplicate accounts in mdl_user I can see that they are both LDAP, and have the same email address, no hashed email or altered username. The do of course have unique ids and it is the first created account that has the allow/deny setting and that I can't go into the profile to see.

When I look at the non-duplicated accounts that have the allow/deny setting, they seem fine in mdl_user too.

Thank you,

Nige.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Ken Task -
Slika Particularly helpful Moodlers
Did you use the cli LDAP sync script?

Dups present a problem if students have already begun any course. Unique ID numbers. So if you can view a students profile see what courses are listed there.
Note the student ID number. Do that on more than one student to get the gist of which ID number is being used.

As far as I know, there is no GUI admin tool to sort this out. žalostan
Maybe those that have dealt with LDAP syncs will chime in here! (Emma?)

Hope you have a recent backup of DB ...

'SoS', Ken
In reply to Ken Task

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hi,

Thanks Ken. We don't use the LDAP sync. It's the second instance/id that is logging in and that's fine. There are no courses for the earliest ID accounts. I'd really like to find something unique about the rouge accounts so that I can find them in the database and initially suspend them before deleting.

Thanks,

Nige.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Ken Task -
Slika Particularly helpful Moodlers

There must be some data about profile that makes them unique.  Check how verifying ... check login name every time ... that kinda thing in set up of ldap.

Finding what caused this will be time cosuming.

'SoS', Ken



In reply to Ken Task

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hiya Ken,

It looks like an Mnet issue. I noticed that the rouge accounts have mnethostid flagged as '1'. In users/accounts/browse, if i filter by mnet provider: id:1(error) I get my rouge accounts. I guess I can now at least delete them and run my new account script again.

Not sure this has happened in the first place as we only get our enrollments via our csv. Mnet is on as we use it to link to Mahara.

Thank you for your help, Ken.

Nigel.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
HI,

Just an update. When I filter and delete users, I check again and a different set of accounts are listed as id:error 1 . Very odd, I'm thinking that there may be an issue with the database žalostan

Thanks

Nige.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Ken Task -
Slika Particularly helpful Moodlers

Since you've mentioned Mahara ... is there sync from Mahara to Moodle?

User ID 1 is the default admin user on most moodle systems.  And, I would imagine, any automated process (like a sync) with users would be executed by that user.

Don't run Mahara ... so this is thinking outloud! :|

'Sos', Ken

In reply to Ken Task

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hi ken,

Thanks. We don't have Mahara syncing with this Moodle at the moment. One thing that I should mention is that we have just migrated and upgraded to 3.9 (new server centos8.2) and this has happened since we started running out account scripts. We have 3 other Mooldes that are exactly the same set up but with no issues.

Thanks,

Nige.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Luis de Vasconcelos -
Can you explain this part a bit more: "Our accounts are scripted and we import new users via a csv."
How are you importing the csv into Moodle? Via the "Upload Users" function in Moodle or via some other method?
In reply to Luis de Vasconcelos

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hiya,

We ftp a csv created by our student management system. It's a bespoke local plugin that does this. It's a bit like Moodle Bulk enrollments via csv. Our csv sets the auth to LDAP.

Thank you,

Nige.
In reply to Otaku Dude

Re: Duplicated Moodle accounts

napisao/la Otaku Dude -
Hi,

Just an update. We found the issue here, it was the $CFG->moodleinstance setting in config.php set to core instead of our usual one for this Moodle (our scripts require it).

The only issue now is deleting the accounts with the incorrect mnethostid. I can filter them in Bulk User Actions but when I delete them they are all still there despite going through the delete process as I normally would. Can these accounts be deleted?

Thanks,

Nigel.