Oh, I didn't knew, I can use custom attributes, cool.. On Mon, Apr 20, 2009 at 5:13 PM, Matt S Trout <dbix-cl...@trout.me.uk>wrote:
> On Sun, Apr 19, 2009 at 05:53:42PM +0400, Nickolay Platonov wrote: > > and I'm using this to implicitly specify which actions in controllers > > require authorization: > > > > #================== > > #Controller > > > > sub update :Local :ActionClass('+Travel::Action::AuthorizationRequired') > { > > my ( $self, $c ) = @_; > > > > my $token = $c->req->params->{'token'}; > > .......... > > } > > > > #================== > > #AuthorizationRequired Action > > > > sub execute { > > my $self = shift; > > my ( $controller, $c ) = @_; > > > > if ( !$c->user_exists() ) { > > > > $c->stash->{template} = "auth_required.tt2"; > > > > $c->detach('View::TT'); > > } > > > > $self->NEXT::execute( @_ ); > > }; > > That's a lot of complexity compared to: > > sub update :Local :AuthorizationRequired { > ... > } > > sub auto :Private { # in Root.pm (or use a root chain part to do the same) > my ($self, $c) = @_; > if ($c->action->attributes->{AuthorizationRequired} && $c->user_exists) { > $c->forward('auth_required'); > return 0; > } > } > > sub auth_required :Private { > my ($self, $c) = @_; > $c->stash(template => 'auth_required.tt2'); > } > > -- > Matt S Trout Need help with your Catalyst or DBIx::Class > project? > Technical Director > http://www.shadowcat.co.uk/catalyst/ > Shadowcat Systems Ltd. Want a managed development or deployment platform? > http://chainsawblues.vox.com/ > http://www.shadowcat.co.uk/servers/ > > _______________________________________________ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ >
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/