The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Apache::Wyrd::User - Abstract user object

SYNOPSIS

    use BASENAME::User;
    my $user = BASENAME::User->new(
      {
        username => 'fingers',
        password => 'caged whale'
      }
    );
    return AUTHORIZATION_REQUIRED unless (
        $user->auth('elucidated bretheren of the ebon night')
    );

DESCRIPTION

Provides an object for the storage of user and user-authorization information.

METHODS

(format: (returns) name (arguments after self))

([anything]) foo ([anything]) (AUTOLOAD)

For most attributes, calling $user->foo where foo is the name of the attribute will return the value. If an argument is supplied, the value is set to the value of the argument. Exceptions are below.

(Apache::Wyrd::User) new (hashref)

Create a new User object, with, at minimum, username, password, auth, and auth_error attributes.

(scalar) store (void)

produce a value that when passed to revive, will re-make the user object. Meant to store the user object in the Apache notes table, but could just as well be used in a file or other medium.

(Apache::Wyrd::User) revive (scalar)

revive the stored user.

(scalar) login_ok (void)

returns true if the user was created by a valid login. Needed because an invalid login creates a user with no authorizations.

(void) get_authorization (void)

initialize the authorization levels of this user. Meant to be called at user creation/revival. Must be implemented by a subclass.

(scalar) auth (scalar)

return true if the user is authorized for a given level. Must be implemented by a subclass.

(scalar) username (void)

Read-only. Return the username of this user.

(scalar) password (void)

Read-only. Return the password of this user.

(scalar) is (scalar)

Return true if the username is equal to the given argument.

BUGS/CAVEATS/RESERVED METHODS

UNKNOWN

AUTHOR

Barry King <wyrd@nospam.wyrdwright.com>

SEE ALSO

Apache::Wyrd

General-purpose HTML-embeddable perl object

LICENSE

Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.