Hi John,<div><br></div><div>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.</div><div><br></div><div>thanks for the guidance..</div>
<div><br></div><div>Regards,</div><div>ROhan<br><br><div class="gmail_quote">On Tue, May 31, 2011 at 7:02 AM, John Romkey <span dir="ltr"><<a href="mailto:romkey@romkey.com">romkey@romkey.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div class="im"><div><div>On May 30, 2011, at 11:27 AM, Rohan M wrote:</div><blockquote type="cite"><div>I got carried away with the other work for the same app. Now I'm back to this point again. </div>
<div><br></div><div>I created a file called User.pm and put it under Model directory. </div>
<div>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.</div>
<div><br></div><div>"Couldn't load class (MyApp) because: The method 'check_password' was not found in the inheritance hierarchy."</div><div><br></div><div>I'm sorry to ask you again but I'm not sure how the following subclassing can be done.</div>
<div><br></div><div>Could you send few more details ( example) ?</div><div><br></div><div>====</div><div><div>package MyApp::Model::User;</div><div>use Moose;</div><div>use namespace::autoclean;</div><div>use Switch;</div>
<div>use base "Catalyst::Authentication::Store::Htpasswd::User";</div><div>extends 'Catalyst::Model';</div><div><br></div><div><br></div><div>around check_password => sub {</div><div> my ($orig, $self, $authinfo, $c, @args) = @_;</div>
<div> my $user = $self->$orig($authinfo, $c, @args);</div><div> return $user;</div><div>}; </div></div><div><br></div><div>OR</div><div><br></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">around find_user => sub {<br>
my ($orig, $self, $authinfo, $c, @args) = @_;<br> my $user = $self->$orig($authinfo, $c, @args);<br> $user->extra_field($c->model('DB::User')->find({ username => $user->id })->first->extra_field;<br>
return $user;<br>};</span></div></blockquote><br></div></div><div>Rohan,</div><div><br></div><div>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</div>
<div><br></div><div>package MyApp::User;</div><div class="im"><div>use Moose;</div><div>use namespace::autoclean;</div></div><div>extends 'Catalyst::Authentication::Store::Htpasswd::User';</div><div class="im"><div>
<br></div><div><div><div>around check_password => sub {</div><div> my ($orig, $self, $authinfo, $c, @args) = @_;</div><div> my $user = $self->$orig($authinfo, $c, @args);</div><div> return $user;</div><div>};</div>
</div><br></div></div><div><div class="im"><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">around find_user => sub {<br> my ($orig, $self, $authinfo, $c, @args) = @_;<br> my $user = $self->$orig($authinfo, $c, @args);<br>
$user->extra_field($c->model('DB::User')->find({ username => $user->id })->first->extra_field;<br> return $user;<br>};</span></div><div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br>
</span></div></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><span style="white-space:pre-wrap">        </span>- john romkey</span></div>
<div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><span style="white-space:pre-wrap">        </span><a href="http://www.romkey.com/" target="_blank">http://www.romkey.com/</a></span></div><div>
<span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div></div><br></div><br>_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
<br></blockquote></div><br><br><div><span style="line-height:32px;font-size:large"><br></span></div><br>
</div>