PApp::UserObs - manage user and access rights
use PApp::UserObs; # this module is obsolete
This is an obsolete module. See also the PApp::User module for additional documentation.
Return true when user has the "admin" access right.
Check wether the current user is already known in the access database. Returns his username (login) if yes, and undef otherwise.
undef
If the optional argument access is given, it additionally checks wether the user has the given access right (even if not logged in).
access
Change the login-name of the current user (or the user with id $userid) to $user and return the userid. If another user of that name already exists, do nothing and return undef. (See choose_username).
$user
choose_username
Guess a more-or-less viable but very probable unique username from the stem given. To create a new username that is unique, use something like this pseudo-code:
while not update_username $username; do $username = choose_username $username done
Set the (non-crypted) password of the current user to $pass. If $pass is undef, the password will be deleted and the user cannot log-in using verify_login anymore. This is not the same as an empty password, which is just that: a valid password with length zero.
$pass
verify_login
Change the comment field for the current user by setting it to $comment.
$comment
Return the username of the user with id $userid or of the current user, if no arguments are given.
$userid
Return the userid associated with the given user.
Creates a new anonymous user and returns her user-id.
Log out the current user, switch to the userid $userid and UNCONDITIONALLY FETCH ACCESS RIGHTS FROM THE USER DB. For a safer interface using a password, see verify_login.
If the $userid is zero creates a new user without any access rights but keeps the state otherwise unchanged. You might want to call save_prefs to save the user preferences (for the current application only, the other preferences currently are discarded).
save_prefs
The $level argument can be used to differentiate between various levels of certainty (1 == http-password, 3 = tls-password, 4 = tls-certificate). The default is 1.
$level
Log the current user out (remove any access rights fromt he current session).
This surl-cookie (see PApp::surl logs the user out (see user_logout) when the link is followed.
PApp::surl
user_logout
Deletes the given userid from the system, i.e. the user with the given ID can no longer log-in or do useful things. Other sessions using this userid will get errors, so don't use this function lightly.
Try to login as user $user, with pass $pass. If the password verifies correctly, switch the userid (if necessary), add any access rights and return true. Otherwise, return false and do nothing else.
Unlike the unix password system, empty password fields (i.e. set to undef) never log-in successfully using this function.
Return the group name associated with the given id.
Create a new group with the given name, updates the comment only if the group already exists.
Delete the group with the given name.
PApp.
Marc Lehmann <schmorp@schmorp.de> http://home.schmorp.de/
To install PApp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PApp
CPAN shell
perl -MCPAN -e shell install PApp
For more information on module installation, please visit the detailed CPAN module installation guide.