[Catalyst] Is there any way to change the catalyst model parameters at the runtime ?

Daniel Westermann-Clark dwc at pobox.com
Mon Aug 27 14:38:06 GMT 2007

On 2007-08-27 15:15:59 +0530, Sandip Patel wrote:
> Actually i am using "Catalyst::Model::LDAP" model, where you have to
> define your ldap configurations (like host, base, dn, password etc)
> into LDAP model and that configuration will be static for all the
> transactions. For all Relational databases, this type of model will
> be ok but for ldap it should bind with the username and password
> which has been provided by the loged in user.

You can accomplish this using version 0.15 of Catalyst::Model::LDAP.

The basic structure goes something like this:

1. In MyApp::Model::LDAP, override ACCEPT_CONTEXT to store the
   username and password from the request.

2. In MyApp::LDAP::Connection, override bind to use the username and
   password from step 1.

If your LDAP server expects just a simple DN and password pair, you
might not even need MyApp::LDAP::Connection.  For example:

package MyApp::Model::LDAP;

use Class::C3;

    my $self = shift;
    my $c = $_[0];

    $self{dn} = $c->req->param('username');
    $self{password} = $c->req->param('password');


For more information on customizing the bind process, please see:


Daniel Westermann-Clark

More information about the Catalyst mailing list