Log In    |    Knowledge Base    |    4D Home
Tech Tip: delete password
Published On: September 29, 2000

It is not uncommon that some users need to be deleted in your 4D password system. If you attempt to do that through the password dialog, you will notice that it is not possible to do so. In 4D, the only way to delete users is to use the DELETE USER command. You delete a user by passing their ID to the DELETE USER command. Users ID numbers can be retrieved using the GET USER LIST command. Once a user is deleted, their ID will never be reassigned to any users that may be added to the database, this is why their name will always be displayed in green in the password management dialog. An alternative strategy is simply to rename users to something like "~inactive01" so they appear at the bottom of the password entry dialog and then re-use them when you need to add new users to the system. Of course, if you set the database properties to not display the user list then inactive accounts are even less of a problem because no one can see them except the Designer or Administrator.

Here is a short sample method for deleting a user:

` method to delete a user from the password system
ARRAY STRING(30;userNames;0)
ARRAY INTEGER(userNumbers;0)
GET USER LIST(userNames;userNumbers)
$userNumToDelete:=Find in array(userNames;$userNameToDelete)
Case of
: ($userNumToDelete=-1)
ALERT("Cannot find a user named '"+$userNameToDelete+"'.")
: (Is user deleted($userNumToDelete))
ALERT("User '"+$userNameToDelete+"' was already deleted.")
DELETE USER($userNumToDelete)
ALERT("User '"+$userNameToDelete+"' successfully deleted!")
End case

This is how the Password system might look before running the above method:

screen shot

And after deleting "DeletedUser":

screen shot

For more information see:


Also see chapters 1 and 9 of the 4th Dimension Design Reference:

* Version 6.x Design Reference
* Version 6.5.x Design Reference