Gantry::Utils::AuthCDBI - Class::DBI base model for Gantry Auth


Gantry documentation Contained in the Gantry distribution.

Index


Code Index:

NAME

Top

Gantry::Utils::AuthCDBI - Class::DBI base model for Gantry Auth

SYNOPSIS

Top

This module expects to retrieve the database connection, username and password from the apache conf file like this:

<Location / > PerlOptions +GlobalRequest

    PerlSetVar auth_dbconn 'dbi:Pg:[database]'
    PerlSetVar auth_dbuser 'myuser'
    PerlSetVar auth_dbpass 'mypass'
</Location>

Or, from the cgi engines constructor:

    my $cgi = Gantry::Engine::CGI->new(
        locations => ...,
        config => {
            auth_dbconn =>  'dbi:Pg:[database]',
            auth_dbuser =>  'myuser',
            auth_dbpass =>  'mypass',
        }
    );

Or, from a script:

    #!/usr/bin/perl

    use Gangtry::Utils::DBConnHelper::Script;

    Gangtry::Utils::DBConnHelper::Script->set_auth_db_conn(
        {
            auth_dbconn =>  'dbi:Pg:[database]',
            auth_dbuser =>  'myuser',
            auth_dbpass =>  'mypass',
        }
    );

DESCRIPTION

Top

This module provide the base methods for Class::DBI, including the db connection through Gantry::Utils::ModelHelper (and its friends in the Gantry::Utils::DBConnHelper family).

METHODS

Top

get_db_options

Returns the dbi connection options, which are usually supplied by Class::DBI's _default_attributes method.

AUTHOR

Top

Tim Keefer <tkeefer@gmail.com>

COPYRIGHT and LICENSE

Top


Gantry documentation Contained in the Gantry distribution.

package Gantry::Utils::AuthCDBI;
use strict; use warnings;

use base 'Class::DBI::Sweet';

# note we ask for auth_db_Main to be imported, but it comes in as db_Main
use Gantry::Utils::ModelHelper qw(
    auth_db_Main
    get_form_selections
    retrieve_all_for_main_listing
);

my $db_options = { __PACKAGE__->_default_attributes };

__PACKAGE__->_remember_handle('Main');

sub get_db_options {
    return $db_options;
}

#-------------------------------------------------
# db_Main
#-------------------------------------------------   
# This method supplied by Gantry::Utils::ModelHelper

#-------------------------------------------------
# $class->get_form_selctions
#-------------------------------------------------
# This method supplied by Gantry::Utils::ModelHelper

#-------------------------------------------------
# $class->retrieve_all_for_main_listing
#-------------------------------------------------
# This method supplied by Gantry::Utils::ModelHelper

1;