Skip to content

Commit

Permalink
use new extended current_user_can and error helper to
Browse files Browse the repository at this point in the history
  issue better errors
  • Loading branch information
ruz committed May 12, 2009
1 parent e902df1 commit 890ec91
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/Wifty/Dispatcher.pm
Expand Up @@ -41,15 +41,16 @@ on '/', run {


# Create a page # Create a page
on '/create/*', run { on '/create/*', run {
set page => $1; set page => $1;
set action => Jifty->web->new_action( class => 'CreatePage' ); set action => Jifty->web->new_action( class => 'CreatePage' );


my $p = Wifty::Model::Page->new(); my $p = Wifty::Model::Page->new;
if($p->current_user_can('create')) { my ($can, $reason) = $p->current_user_can('create');
show("/create"); unless ( $can ) {
} else { error( create => $reason);
show("/no_such_page"); } else {
} show("/create");
}
}; };


# View or edit a page # View or edit a page
Expand Down

0 comments on commit 890ec91

Please sign in to comment.