NAME

WE::DB::ComplexUser - Webeditor user database.

SYNOPSIS

 use WE::DB::ComplexUser;
 my $udb = WE::DB::ComplexUser->new($root_db, $user_db_file, %args);

DESCRIPTION

Object for administration of webeditor-users. You can add, delete, identify, modify users.

This is an MLDBM implementation of the WE::DB::User module. The user elements are WE::UserObj (this may be changed by override the UserObjClass method) objects with the following members:

Username

The short name for the user.

Password

The (probably crypted) password.

Realname

The full name of the user.

Groups

An array reference to the groups of this user.

Roles

An array reference to the roles of this user.

Email

The email address of the user.

Homedirectory

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.

Shell

The shell of the user. This may be the classical UNIX shell.

Language

The preferred language of the user. This should be a string or an array of languages.

CONSTRUCTOR

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:

-crypt => 'crypt'

Use crypt for crypting password (default).

-crypt => 'none'

Do not crypt passwords.

METHODS

$udb->add_user($username,$password,$fullrealname)

This is deprecated, use "$udb->add_user_object" instead.

Add a user with the specified $username, I$<password> and $fullrealname. Return 1 (ERROR_OK) if creation of user was successful. Die on errors (e.g. if invalid characters or an invalid username is used).

$udb->add_user_object($o)

Add a user with the specified WE::UserObj object. Return 1 (ERROR_OK) if creation of user by object was successful. See "$udb->add_user" for exceptions.

$udb->get_fullname($username)

Return string with full reallife name.

$udb->identify($username,$entered_password)

Identify the given $username with the $entered_password and return 1 (ERROR_OK), if the authentication was successful.

$udb->identify_object($username,$entered_password)

Identify the given $username with the $entered_password and return the user object, if the authentication was successful.

$udb->user_exists($username)

Return 1 if the specified $username exists.

$udb->delete_user($username)

Delete the specified $username. Return 1 (ERROR_OK) if successful.

$udb->is_in_group($username,$group)

Return 1 if $username is in the named $group.

$udb->get_groups($username)

Return an array of the $username's groups.

Return 1 if $username is in the named $group.

$udb->add_group($username,$group)

Add the given $group to the $username. Return 1 (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.

$udb->set_groups($username, @groups)

Replace $username's group list with @groups. Die if invalid characters are used.

$udb->delete_group($username,$group)

Delete the given $group from the $username's group list. Return 1 (ERROR_OK) if deleting group was successful.

$udb->get_users_of_group($group)

Return an array of usernames belonging to this $group.

$udb->get_all_users()

Return an array of all existing users.

$udb->get_all_groups()

Return an array of all existing groups.

$udb->get_user_object($user)

Return a WE::UserObj object for the given $user, or undef.

$udb->set_user_object($o)
$udb->set_user_object($user, $o)

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.

$udb->delete_all_groups

Delete all existing groups (globally and for each user).

$udb->delete_group_definition($group)

Delete the named $group (globally and for each user).

$udb->add_group_definition($group, %args)

Add a new $group globally. %args is unused for now.

$udb->get_group_definition($group)

Return the $group definition as a hash reference or undef.

$udb->set_group_definition($group, $o)

Replace the group definition $o for the given $group.

$udb->_predefined_groups

Return an array with predefined groups. This method may be overridden by a sub class.

$udb->set_password($userobj, $password)

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.

CONSTANTS

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

AUTHORS

Olaf Mätzner - maetzner@onlineoffice.de, Slaven Rezic - slaven@rezic.de

SEE ALSO

WE::DB, WE::DB::User

1 POD Error

The following errors were encountered while parsing the POD:

Around line 925:

Non-ASCII character seen before =encoding in 'Mätzner'. Assuming CP1252