How to delete a remote user?

How to delete a remote user?

by Przemyslaw Stencel -
Number of replies: 5
Hi all,

What is the best way to delete the account of a user who comes from a remote moodle site? In the user management screen I can only deny access for those users, I cannot delete their accounts completely.

I thought of two possible ways to delete such remote users.
  1. Just delete those accounts from the database. This looks like a simple and effective way of getting rid of those accounts, but I have a gut feeling it's not the best way. If I do it this way, I might end up with a lot of "ghosts", that is, if those remote users have enrolled and participated in some courses, their profiles would be referenced from those courses and those references would be broken.
  2. Go into the database and change the mnethostid value to 1 (I might also have to change their usernames and email addresses to avoid conflicts with non-remote accounts). This would mean that those accounts are no longer treated as remote, so I could then delete them properly using the standard user management procedure.

Could someone more knowledgeable tell me which one of these procedures is better, or give a third alternative if none of these two is good enough?

Now, I guess you'll be wondering why I need to delete those accounts, rather than just deny access for them. That's because they are not really remote users, these are duplicates of our own accounts which were created when we were affected by bug 10828. As a result, our moodle became schizophrenic and treated itself as a remote host and our users who were trying to log in at that time, were asked to create their accounts again (we use pop3 authentication). And this is how we ended up with a lot of duplicate accounts and now I need to weed out those which were created during that bug attack. I cannot simply leave them be and just deny access for them, because they still (even though they have no access) show up on the users' list, for example when teachers are adding students to the courses.

TIA,
Przemek

PS
We're currently using moodle 1.8.4+

Average of ratings: -
In reply to Przemyslaw Stencel

Re: How to delete a remote user?

by Greg Rodenhiser -
Ever find and answer. We're pondering deploying Moodle Network and have several different Moodle instances for different projects/groups, but won't do this until these details are ironed out.
In reply to Przemyslaw Stencel

Re: How to delete a remote user?

by Robin Singh -
I you want to delete the Roaming User follow the below steps:
  1. Set the delete flag to one for the remote user
  2. Append time stamp to user name
  3. Deny the user access by in mnet_sso_access_control table.
We have used this above approach and it worked well in Moodle 1.9.7. Ideally Moodle never delete a user record but mark it as delete.

Hope this helps.
In reply to Robin Singh

Re: How to delete a remote user?

by Heather P -
Hi

we too wanted to be able to do this.
Where exactly is the delete flag please?
Thanks
Heather
In reply to Heather P

Re: How to delete a remote user?

by Robin Singh -
Hello Heather,

You could find the Delete flag in the user table. For all the active user, deleted column will have the value 0. For all the deleted user the deleted field will have the value as 1 and timestamp is appended to the user name.

Note : All the remote user networked using Moodle Network with have the auth value as mnet.

Hope this helps.
In reply to Robin Singh

Re: How to delete a remote user?

by satyajit Choudhury -
Not pretty sure that if am using it correctly but i was able to delete all the remote users. I just logged in to Remote site with admin priviledge and went to "Bulk User Action" searched for the user (remote), selected them and deleted them.

Not sure if it helps.
Average of ratings: Useful (1)