Eidolon::Driver::User - Eidolon generic user driver.


Eidolon documentation  | view source Contained in the Eidolon distribution.

Index


NAME

Top

Eidolon::Driver::User - Eidolon generic user driver.

SYNOPSIS

Top

Example user driver:

    package MyApp::Driver::User;
    use base qw/Eidolon::Driver::User/;

    sub authorized
    {
        my $self = shift;
        throw DriverError::User("This is just an example!");
    }

DESCRIPTION

Top

The Eidolon::Driver::User is a generic user driver for Eidolon. It declares some functions that are common for all driver types and some abstract methods, that must be overloaded in ancestor classes. All user drivers should subclass this package.

METHODS

Top

new()

Class constructor. Creates the driver object and calls object initialization function.

authorize($login)

Authorize user. Abstract method, should be overloaded in ancestor class.

unauthorize()

Unauthorize user. Abstract method, should be overloaded in ancestor class.

authorized()

Checks if user is authorized. Abstract method, should be overloaded in ancestor class.

ATTRIBUTES

Top

The Eidolon::Driver::User package has got several useful class attributes that filled in during object initialization. These variables could be accessed through driver object using hashref or subroutine syntax:

    my ($r, $user, $ip, $referer);

    $r       = Eidolon::Core::Registry->get_instance;
    $user    = $r->loader->get_object("Eidolon::Driver::User");

    $ip      = $user->ip;       # or $user->{"ip"}
    $referer = $user->referer;  # or $user->{"referer"}

agent

User's HTTP user agent string (User-Agent: field in HTTP request header).

ip

User's remote IP address (in string format).

language

User's preferred language string, that is transferred in HTTP request header in Accept-Languages: field. If this field contains more than one language, first is used.

referer

User's HTTP referer (Referer: field in HTTP request header).

SEE ALSO

Top

Eidolon, Eidolon::Driver::User::Exceptions

LICENSE

Top

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Top

Anton Belousov, <abel@cpan.org>

COPYRIGHT

Top


Eidolon documentation  | view source Contained in the Eidolon distribution.