X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F06_Authorization.pod;h=3eeacc32103ed62c6026da204572b2a87a0aafe2;hp=1ecff82c5ab231d8b8b2a984f0c15a73c4d57528;hb=4768184b3b277399116fbd53cae3697a9767fee5;hpb=5988477160c698d0e5efd1cf1911845d40a327cf
diff --git a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod
index 1ecff82..3eeacc3 100644
--- a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod
+++ b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod
@@ -80,33 +80,24 @@ Edit C and add C to the list:
# Load plugins
use Catalyst qw/
- -Debug
- ConfigLoader
- Static::Simple
-
- StackTrace
-
- Authentication
- Authorization::Roles
+ -Debug
+ ConfigLoader
+ Static::Simple
- Session
- Session::Store::FastMmap
- Session::State::Cookie
- /;
-
-B As discussed in MoreCatalystBasics, different versions of
-C have used a variety of methods to load the plugins.
-You can put the plugins in the C
This code displays a different combination of links depending on the
-roles assigned to the user.
+roles assigned to the user.
=head2 Limit Books::add to 'admin' Users
@@ -181,11 +172,9 @@ updating C to match the following code:
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Assign the Book object to the stash for display in the view
- $c->stash->{book} = $book;
-
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Assign the Book object to the stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
} else {
# Provide very simple feedback to the user.
$c->response->body('Unauthorized!');
@@ -211,10 +200,9 @@ C and C<=end> after the closing C<}>.
=head2 Try Out Authentication And Authorization
-Press C to kill the previous server instance (if it's still
-running) and restart it:
+Make sure the development server is running:
- $ script/myapp_server.pl
+ $ script/myapp_server.pl -r
Now trying going to L and you should
be taken to the login page (you might have to C or
@@ -267,7 +255,7 @@ this method to our Result Class. Open
C and add the following method below
the "C" line:
- =head 2 has_role
+ =head2 has_role
Check if a user has the specified role
@@ -320,10 +308,10 @@ C and add this method:
=cut
- sub error_noperms :Chained('/') :PathPath('error_noperms') :Args(0) {
+ sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) {
my ($self, $c) = @_;
- $c->stash->{template} = 'error_noperms.tt2';
+ $c->stash(template => 'error_noperms.tt2');
}
And also add the template file by putting the following text into
@@ -331,10 +319,6 @@ C:
Permission Denied
-Then run the Catalyst development server script:
-
- $ script/myapp_server.pl
-
Log in as C and create several new books using the C
feature:
@@ -359,6 +343,6 @@ Please report any errors, issues or suggestions to the author. The
most recent version of the Catalyst Tutorial can be found at
L.
-Copyright 2006-2008, Kennedy Clark, under Creative Commons License
+Copyright 2006-2010, Kennedy Clark, under Creative Commons License
(L).