Hi John, I'll give a try and post it after the successful run. Meanwhile, a workaround , I used session to store db object for the user and used it.
thanks for the guidance.. Regards, ROhan On Tue, May 31, 2011 at 7:02 AM, John Romkey <[email protected]> wrote: > On May 30, 2011, at 11:27 AM, Rohan M wrote: > > I got carried away with the other work for the same app. Now I'm back to > this point again. > > I created a file called User.pm and put it under Model directory. > After putting, use base > "Catalyst::Authentication::Store::Htpasswd::User"; I am trying to use > around find_user or any method that is present in the base class but I ended > up getting following error. > > "Couldn't load class (MyApp) because: The method 'check_password' was not > found in the inheritance hierarchy." > > I'm sorry to ask you again but I'm not sure how the following subclassing > can be done. > > Could you send few more details ( example) ? > > ==== > package MyApp::Model::User; > use Moose; > use namespace::autoclean; > use Switch; > use base "Catalyst::Authentication::Store::Htpasswd::User"; > extends 'Catalyst::Model'; > > > around check_password => sub { > my ($orig, $self, $authinfo, $c, @args) = @_; > my $user = $self->$orig($authinfo, $c, @args); > return $user; > }; > > OR > > around find_user => sub { > my ($orig, $self, $authinfo, $c, @args) = @_; > my $user = $self->$orig($authinfo, $c, @args); > $user->extra_field($c->model('DB::User')->find({ username => $user->id > })->first->extra_field; > return $user; > }; > > > Rohan, > > I haven't verified this but I think that what you want to do is make it be > a regular class, not a Catalyst component. Then in your configuration where > you specify your user_class for your store use MyApp::User rather than > Catalyst::Authentication::Store::Htpasswd::User > > package MyApp::User; > use Moose; > use namespace::autoclean; > extends 'Catalyst::Authentication::Store::Htpasswd::User'; > > around check_password => sub { > my ($orig, $self, $authinfo, $c, @args) = @_; > my $user = $self->$orig($authinfo, $c, @args); > return $user; > }; > > around find_user => sub { > my ($orig, $self, $authinfo, $c, @args) = @_; > my $user = $self->$orig($authinfo, $c, @args); > $user->extra_field($c->model('DB::User')->find({ username => $user->id > })->first->extra_field; > return $user; > }; > > > - john romkey > http://www.romkey.com/ > > > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[email protected]/ > Dev site: http://dev.catalyst.perl.org/ > >
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
