From: hkclark Date: Thu, 1 Sep 2011 00:36:56 +0000 (-0400) Subject: Update for VM and StatusMessage X-Git-Tag: 5.9003~25^2~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=333f9299012b2bafa32a49bf8fc7e26dbdcbd693 Update for VM and StatusMessage --- diff --git a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod index 47bc345..10debad 100644 --- a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod +++ b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod @@ -57,8 +57,9 @@ L =head1 DESCRIPTION This chapter of the tutorial adds role-based authorization to the -existing authentication implemented in Chapter 5. It provides simple -examples of how to use roles in both TT templates and controller +existing authentication implemented in +L. It provides +simple examples of how to use roles in both TT templates and controller actions. The first half looks at basic authorization concepts. The second half looks at how moving your authorization code to your model can simplify your code and make things easier to maintain. @@ -92,6 +93,8 @@ Edit C and add C to the list: Session Session::Store::File Session::State::Cookie + + StatusMessage /; Once again, include this additional plugin as a new dependency in the @@ -189,8 +192,9 @@ message. Note that we intentionally chose to display the message this way to demonstrate that TT templates will not be used if the response body has already been set. In reality you would probably want to use a technique that maintains the visual continuity of your template layout -(for example, using the "status" or "error" message feature added in -Chapter 3 or C to an action that shows an "unauthorized" page). +(for example, using L as shown in the +L to +redirect to an "unauthorized" page). B: If you want to keep your existing C method, you can create a new copy and comment out the original by making it look like a @@ -299,7 +303,8 @@ match the following code: $c->flash->{status_msg} = "Book deleted"; # Redirect the user back to the list page - $c->response->redirect($c->uri_for($self->action_for('list'))); + $c->response->redirect($c->uri_for($self->action_for('list'), + {mid => $c->set_status_msg("Deleted book $id")})); } Here, we C to an error page if the user is lacking the