WE::DB::ComplexUser - Webeditor user database.
use WE::DB::ComplexUser; my $udb = WE::DB::ComplexUser->new($root_db, $user_db_file, %args);
Object for administration of webeditor-users. You can add, delete, identify, modify users. This is an MLDBM implementation of the WE::DB::User module.
NOTE Due to histerical reasons, the returned value of most methods is not a boolean value as one would expect. Rather the
ERROR_* constants should be used instead, see "CONSTANTS".
The user elements are objects of the class
WE::UserObj (this may be changed by overriding the UserObjClass method) objects with the following members:
The short name for the user.
The (probably crypted) password.
The full name of the user.
An array reference to the groups of this user.
An array reference to the roles of this user.
The email address of the user.
The home directory of the user. This may be the classical UNIX home directory, or the default starting point in the web.editor tree hierarchy.
The shell of the user. This may be the classical UNIX shell.
The preferred language of the user. This should be a string or an array of languages.
The authentication type of the user. The default (undef, empty string or "userdb") means to use the Password entry of the ComplexUser database. For other values an external module is consulted, which is named
WE::DB::ComplexUser::Authauthtype. See WE::DB::ComplexUser::AuthPOP3 and WE::DB::ComplexUser::AuthUnix.
An automatically increased identifier, which is set when adding the object to the database. Note that the Username is used to identify an user object, not the Id.
There's also elements of the class
WE::GroupObj for group objects. The group objects have the following members:
The full name of the group
A description of the group's purpose
An Id, see the WE::UserObj description for Id.
Note that accessing
WE::GroupObj objects is not very efficient, especially for databases with a large group number.
my $udb = WE::DB::ComplexUser->new($root_db, $user_db_file, %args);
The $root_db argument is optional and should be either
undef or a WE::DB object.
The $user_db_file is the pathname to the database file.
Remaining arguments may be:
Use crypt for crypting password (default).
Do not crypt passwords.
This is deprecated, use "$udb->add_user_object" instead.
Add a user with the specified $username, I$<password> and $fullrealname. Return ERROR_OK if creation of user was successful. Die on errors (e.g. if invalid characters or an invalid username is used).
Add a user with the specified
WE::UserObj object. Return ERROR_OK if creation of user by object was successful. See "$udb->add_user" for exceptions.
Return string with full reallife name.
Identify the given $username with the $entered_password and return 1 (ERROR_OK), if the authentication was successful.
Identify the given $username with the $entered_password and return the user object, if the authentication was successful.
Return 1 if the specified $username exists.
Delete the specified $username. Return ERROR_OK if successful.
Return 1 if $username is in the named $group.
Return an array of the $username's groups.
Add the given $group to the $username. Return ERROR_OK if adding group to user was successful. Note: there's no check if the named group really exists. Die if invalid characters are used.
Replace $username's group list with @groups. Die if invalid characters are used.
Delete the given $group from the $username's group list. Return ERROR_OK if deleting group was successful.
Return an array of usernames belonging to this $group.
Return an array of all existing users.
Return an array of all existing groups.
WE::UserObj object for the given $user, or
Replace the user $user with the
WE::UserObj object $o. In the first form, the username is taken from $o. Return the user object or die on errors.
Delete all existing groups (globally and for each user).
Delete the named $group (globally and for each user).
Add a new $group globally. %args is unused for now.
Return the $group definition as a hash reference or
Replace the group definition $o for the given $group.
Return an array with predefined groups. This method may be overridden by a sub class.
Set the $password in the given $userobj. Depending on the crypt mode of the user database, this will be encrypted or unencrypted. Does not save the $userobj into the database. Use this method instead of setting the Password member in the $userobj directly.
Set how errors are handled:
If errors are encountered, the method will die. This is the default.
If errors are encountered, the method will return with an error code. The error message can be fetched by
Without argument return the current value.
These error constants may be used, either fully qualified or as static methods:
An incompatible change occurred around 2005-02-16 (between version 2.19 and 2.20): adding an existing user used to return "0", but now it returns
Olaf Mätzner - firstname.lastname@example.org, Slaven Rezic - email@example.com