User Update Notification
Since version 0.72 it has been possible to have the Users and Groups
module notify your module when a Unix user is added, updated or deleted.
This can be useful if your module deals with additional information that is
associated with users. For example, the Disk Quotas module sets
default quotas when new users are created, and the Samba Windows File
Sharing module keeps the Samba password file in sync with the Unix user
list.
To have your module notified when a user is added, updated or deleted you
must create a perl script called useradmin_update.pl in your
module directory. This file must contain three perl functions :
- useradmin_create_user(user)
- This function is called when a new Unix user is created. The parameter
is a hash containing the details of the new user, described in more detail
below.
- useradmin_modify_user(user)
- This function is called when an existing Unix user is modified in any
way. The parameter is a hash containing the new details of the user.
- useradmin_delete_user(user)
- This function is called when a Unix user is deleted. Like the other
functions, the hash containing the user's details.
The hash reference passed to each of the three functions has the following
keys :
| user |
The login name of the new or modified user |
| uid |
The Unix UID of the user |
| gid |
The Unix GID for the user's primary group |
| pass |
The user's password, encrypted with the crypt() function |
| plainpass |
The user's password in plain text. This is only available when the
passmode key is equal to 3 |
| passmode |
This number depends on the choice made for the Password field
in the Create User or Edit User form.
- No password is set for this user, typically meaning that no
password is required to login
- This user is not allowed to login at all
- Only the encrypted password for this user is available
- A new or initial plain-text password is available in the
plainpass key.
- The user's password is unchanged. Only possible when
useradmin_modify_user is called.
|
| real |
The user's real name |
| home |
The user's home directory |
| shell |
The user's login shell |
If the system has shadow passwords enabled, other keys may also be available -
but it is not a good idea to rely on them.
When your functions are called, they will be in the context of your module.
This means that your useradmin_update.pl script can require
the file of common functions used by other CGI programs. The functions can
perform any action you like in order to update other config files or whatever,
but should not generate any output on STDOUT, or take too long to execute.