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".
ERROR_*
The user elements are objects of the class WE::UserObj (this may be changed by overriding the UserObjClass method) objects with the following members:
WE::UserObj
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.
WE::DB::ComplexUser::Authauthtype
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:
WE::GroupObj
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.
undef
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.
Return a WE::UserObj object for the given $user, or undef.
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 undef.
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 $udb->ErrorMsg.
$udb->ErrorMsg
Without argument return the current value.
These error constants may be used, either fully qualified or as static methods:
ERROR_NOT_ACCEPTED
ERROR_OK
ERROR_INVALID_CHAR
ERROR_GROUP_EXISTS
ERROR_USER_EXISTS
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 ERROR_USER_EXISTS.
Olaf Mätzner - maetzner@onlineoffice.de, Slaven Rezic - slaven@rezic.de
WE::DB, WE::DB::User
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Mätzner'. Assuming CP1252
To install WE::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WE::DB
CPAN shell
perl -MCPAN -e shell install WE::DB
For more information on module installation, please visit the detailed CPAN module installation guide.