List Info

Thread: Re: Reaction Authentication




Re: Reaction Authentication
user name
2007-01-29 07:12:26


On 28/01/07, Guillermo Roditi < groditigmail.com">groditigmail.com> wrote:
FIXED IT!!!

take out the does '...&#39; line and replace it with this:

override parameter_hashref => sub{
 ; &nbsp; my $self = shift;
&nbsp; &nbsp; my $args = super();
&nbsp;   ;$args-> = delete $args->{new_password};
&nbsp; &nbsp; delete $args->{confirm_new_password};
 &nbsp; &nbsp;return $args;
};


here's my class:

package Prefab::Model::Action::CreateUser;

use strict;
use warnings;

use Reaction::Class;
use aliased 'Reaction::InterfaceModel::Action:BIC::ActionReflector&#39;;

extends qw(
   ; &nbsp; &nbsp; &nbsp;  Reaction::InterfaceModel::Action::User::SetPassword
&nbsp; &nbsp;   ; &nbsp; &nbsp; Reaction::InterfaceModel::Action:BIC::ResultSet::Create
 &nbsp;   ; &nbsp; &nbsp; );

my $r = ActionReflector->new;
$r->reflect_attrs('Prefab::Schema::User'  ;=> ; __PACKAGE__,
&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; qw/id username created_d role_list/);

override parameter_hashref => sub{
&nbsp; &nbsp; my $self = shift;
&nbsp; &nbsp; my $args = super();
&nbsp;   ;$args-> = delete $args->{new_password};
   ; delete $args->{confirm_new_password};
 &nbsp; &nbsp;return $args;
};

1;



If you want to reflect fields like i did then add this method to
action reflector:

 &nbsp;implements reflect_attrs => as {
 &nbsp; &nbsp;my ($self, $from_class, $to_class, attrs) = _;
 &nbsp;  foreach my $attr_name (attrs) {
 &nbsp; &nbsp;  $self->reflect_attribute_to($from_class,
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;$from_class->meta->get_attribute($attr_name),
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  $to_class);
&nbsp; &nbsp; }
  ;};

Cool, I like that reflect_attrs method, I'm already using it.
I have tried your aproach before. You can't delete the 'new_password'; and 'confirm_new_password' or the confirm_password is not checked against 'new_password';.
You have to live with the warnings in the error log.
But it doesn't work for me either. The problem is that Reaction::InterfaceModel::Action::User::SetPassword and Reaction::InterfaceModel::Action:BIC::Role::CheckUniques both override 'error_for_attribute' and 'can_apply'. So if you have unique constraints in your schema they don't get evaluated if your class extends from User::SetPassword before ResultSet::Create
or if you reverse the order then your confirm password is not checked. I tried to change the methods from override to augment and the super() call to an inner() call but i got following error:
Moose::Role cannot support 'augment' at /usr/local/share/perl/5.8.7/Moose/Role.pm line 138

So i don't know how to fix this.

--
Jonas

Re: Reaction Authentication
user name
2007-01-29 07:52:14
Role's don't do augment. I'll look further into this though

On 1/29/07, Jonas Alves <jonas.alvesgmail.com> wrote:
>
>
>
> On 28/01/07, Guillermo Roditi <groditigmail.com> wrote:
> > FIXED IT!!!
> >
> > take out the does '...' line and replace it with
this:
> >
> > override parameter_hashref => sub{
> >     my $self = shift;
> >     my $args = super();
> >     $args-> = delete
$args->;
> >     delete $args->;
> >     return $args;
> > };
> >
> >
> > here's my class:
> >
> > package Prefab::Model::Action::CreateUser;
> >
> > use strict;
> > use warnings;
> >
> > use Reaction::Class;
> > use aliased
> 'Reaction::InterfaceModel::Action:BIC::Act
ionReflector';
> >
> > extends qw(
> >
> Reaction::InterfaceModel::Action::User::SetPassword
> >
> Reaction::InterfaceModel::Action:BIC::Res
ultSet::Create
> >           );
> >
> > my $r = ActionReflector->new;
> > $r->reflect_attrs('Prefab::Schema::User' 
=>
> __PACKAGE__,
> >                   qw/id username created_d
role_list/);
> >
> > override parameter_hashref => sub{
> >     my $self = shift;
> >     my $args = super();
> >     $args-> = delete
$args->;
> >     delete $args->;
> >     return $args;
> > };
> >
> > 1;
> >
> >
> >
> > If you want to reflect fields like i did then add
this method to
> > action reflector:
> >
> >   implements reflect_attrs => as {
> >     my ($self, $from_class, $to_class, attrs) =
_;
> >     foreach my $attr_name (attrs) {
> >       $self->reflect_attribute_to($from_class,
> >
> $from_class->meta->get_attribute($attr_name),
> >                                   $to_class);
> >     }
> >   };
>
> Cool, I like that reflect_attrs method, I'm already
using it.
> I have tried your aproach before. You can't delete the
'new_password' and
> 'confirm_new_password' or the confirm_password is not
checked against
> 'new_password'.
> You have to live with the warnings in the error log.
> But it doesn't work for me either. The problem is that
> Reaction::InterfaceModel::Action::User::SetPassword
and
> Reaction::InterfaceModel::Action:BIC::Rol
e::CheckUniques
> both override 'error_for_attribute' and 'can_apply'. So
if you have unique
> constraints in your schema they don't get evaluated if
your class extends
> from User::SetPassword before ResultSet::Create
> or if you reverse the order then your confirm password
is not checked. I
> tried to change the methods from override to augment
and the super() call to
> an inner() call but i got following error:
> Moose::Role cannot support 'augment' at
> /usr/local/share/perl/5.8.7/Moose/Role.pm line 138
>
> So i don't know how to fix this.
>
> --
> Jonas
>
>
> _______________________________________________
> List: Catalystlists.rawmode.org
> Listinfo:
> ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-
archive.com/catalystlists.rawmode.org/
> Dev site: http://dev.catalyst.per
l.org/
>
>
>

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: Reaction Authentication
user name
2007-01-29 08:17:33
On 29 Jan 2007, at 13:12, Jonas Alves wrote:
>
> I have tried your aproach before. You can't delete the 

> 'new_password' and 'confirm_new_password' or the
confirm_password  
> is not checked against 'new_password'.
> You have to live with the warnings in the error log.
> But it doesn't work for me either. The problem is that 

> Reaction::InterfaceModel::Action::User::SetPassword and
 
> Reaction::InterfaceModel::Action:BIC::Rol
e::CheckUniques both  
> override 'error_for_attribute' and 'can_apply'. So if
you have  
> unique constraints in your schema they don't get
evaluated if your  
> class extends from User::SetPassword before
ResultSet::Create
> or if you reverse the order then your confirm password
is not  
> checked. I tried to change the methods from override to
augment and  
> the super() call to an inner() call but i got following
error:
> Moose::Role cannot support 'augment' at
/usr/local/share/perl/5.8.7/ 
> Moose/Role.pm line 138
>

We almost certainly want to be using roles for all of this
with around 
() so it can wrap in-place and doesn't automatically jump to
superclass.

The current user stuff is mostly a very simple convenience
API that  
needs its guts factoring out into more easily composable
components.  
Patches to do so welcome 

-- 
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support
contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at)
shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +



_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )