Not long ago, Fernan Aguero proclaimed... > 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; > > }
This is an interesting strategy. The only thing I question is the $c->login() call because the username field is not unique (there could be more than one 'johndoe' in the table). After I posted my original question, I started wondering about concatenating the username and site_id together. I have a feeling this won't fly well inside DBIx::Class, but in theory if I declare the user field to be "username || '#' || site_id" and call the login() using $username . '#' . $c->stash->{'site_id'}, the resulting SELECT in sql would find the unique row. Of course, that all falls apart in the ORM, most likely. -- [EMAIL PROTECTED] is Doran L. Barton, president/CTO, Iodynamics LLC Iodynamics: IT and Web services by Linux/Open Source specialists "Free: farm kittens, ready to eat" -- Seen in a newspaper
pgpFReYA8aB79.pgp
Description: PGP signature
_______________________________________________ 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/