+----[ Doran L. Barton <[EMAIL PROTECTED]> (26.Mar.2007 01:39): | | I'd like some advice on how to do this. I'm developing a single Cat app | that will handle multiple sites by looking at the 'host' header. All | sites will be associated with domain names under a specific domain. Think | wildcard A records in DNS, if you will. For example, all of the following | would be caught and handled by the app: | | foo.mycatalystsite.com | bar.mycatalystsite.com | foobar.mycatalystsite.com | | I want each site to have its own pool of users for authentication. The | users table, therefore, has a site_id associated with each user. | | Herein lies the gotcha! I need to be able to tell the Authentication plugin | to authenticate the user using $username, $password, and a site_id (as | opposed to the usual $username and $password). After looking through the | Catalyst::Plugin::Authentication::Store::DBIC code, I can't immediately see | how I could subclass it and add this functionality. | | Thoughts, anyone? | +----]
Certainly not what you were asking (subclassing store::dbic), but ... sub login : Local { my ( $self, $c ) = @_; my $username = $c->req->params->{username} || ""; my $password = $c->req->params->{password} || ""; my $model = $c->model('Users'); if ( $username && $password ) { # attempt to login if ( $c->login( $username, $password ) ) { # now we check site_id $ok = $model->search( { username => $username, password => $password, site_id => $site_id } )->count(); $c->logout unless $ok > 0; } } else { ... _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/