Why not adopt me?
NAME
User::Simple::Admin - User::Simple user administration
SYNOPSIS
$ua = User::Simple::Admin->new($db, $user_table);
$ua = User::Simple::Admin->create_db_structure($db, $user_table);
$ok = User::Simple::Admin->has_db_structure($db, $user_table);
%users = $ua->dump_users;
$id = $ua->id($login);
$login = $ua->login($id);
$name = $ua->name($id);
$is_admin = $ua->is_admin($id);
$ok = $usr->set_login($id, $login);
$ok = $usr->set_name($id, $name);
$ok = $usr->set_admin($id);
$ok = $usr->unset_admin($id);
$ok = $usr->set_passwd($id, $passwd);
$ok = $usr->clear_session($id);
$id = $ua->new_user($login, $name, $passwd, $is_admin);
$ok = $ua->remove_user($id);
DESCRIPTION
Administrative actions for User::Simple modules are handled through this Admin object. To instantiate it:
$a = User::Simple::Admin->new($db, $user_table);
$db is an open connection to the database where the user data is stored.
If we do not yet have the needed DB structure to store the user information, we can use this method as a constructor as well.
$ok = User::Simple::Admin->create_db_structure($db, $user_table)
In order to check if the database is ready to be used by this module with the specified table name.
%users = $ua->dump_users;
Will return a hash with the data regarding the registered users, in the following form:
( $id1 => { is_admin => $is_admin1, name => $name1, login => $login1},
$id2 => { is_admin => $is_admin2, name => $name2, login => $login2},
(...) )
$id = $ua->new_user($login, $name, $passwd, $is_admin);
Creates a new user with the specified data. $is_admin is a boolean value - Use 1 for true, 0 for false. Returns the new user's ID.
$ok = $ua->remove_user($id);
Removes the user specified by the ID.
$id = $ua->id($login);
$login = $ua->login($id);
$name = $ua->name($id);
$is_admin = $ua->is_admin($id);
Get the value of each of the mentioned attributes. Note that in order to get the ID you can supply the login, every other method answers only to the ID. In case you have the login and want to get the name, you should use $ua-
name($ua->id($login));>
$ok = $usr->set_login($id, $login);
$ok = $usr->set_name($id, $name);
$ok = $usr->set_passwd($id, $passwd);
Modifies the requested attribute of the specified user, setting it to the new value.
$ok = $usr->set_admin($id);
$ok = $usr->unset_admin($id);
Sets or removes the administrative status of this user.
$ok = $usr->clear_session($id);
Removes the session which the current user had open, if any.
DEPENDS ON
SEE ALSO
User::Simple for the regular user authentication routines (that is, to use the functionality this module adimisters)
AUTHOR
Gunnar Wolf <gwolf@gwolf.org>
COPYRIGHT
Copyright 2005 Gunnar Wolf / Instituto de Investigaciones Económicas UNAM This module is Free Software, it can be redistributed under the same terms as Perl.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 112:
Non-ASCII character seen before =encoding in 'Económicas'. Assuming CP1252