X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F06_Authorization.pod;h=1ecff82c5ab231d8b8b2a984f0c15a73c4d57528;hb=3f043f410582fbbc0d26ccc09060fdbcc7150df0;hp=cda2f7b2c06f76f2ca20c1251237bc07e91a5fed;hpb=3ab6187c1a123983b6ae29e57f543328ce15755c;p=catagits%2FCatalyst-Manual.git diff --git a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod index cda2f7b..1ecff82 100644 --- a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod +++ b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod @@ -79,7 +79,8 @@ Catalyst. Edit C and add C to the list: # Load plugins - use Catalyst qw/-Debug + use Catalyst qw/ + -Debug ConfigLoader Static::Simple @@ -107,6 +108,7 @@ like this: 'Catalyst::Plugin::Authorization::Roles' => '0', ); + =head2 Add Role-Specific Logic to the "Book List" Template Open C in your editor and add the following @@ -117,7 +119,7 @@ lines to the bottom of the file:
    [% # Dump list of roles -%] - [% FOR role = c.user.role %]
  • [% role %]
  • [% END %] + [% FOR role = c.user.roles %]
  • [% role %]
  • [% END %]

@@ -175,9 +177,9 @@ updating C to match the following code: # Add a record to the join table for this book, mapping to # appropriate author - $book->add_to_book_author({author_id => $author_id}); + $book->add_to_book_authors({author_id => $author_id}); # Note: Above is a shortcut for this: - # $book->create_related('book_author', {author_id => $author_id}); + # $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; @@ -305,7 +307,7 @@ match the following code: # Redirect the user back to the list page $c->response->redirect($c->uri_for($self->action_for('list'))); - } + } Here, we C to an error page if the user is lacking the appropriate permissions. For this to work, we need to make @@ -355,7 +357,7 @@ Kennedy Clark, C Please report any errors, issues or suggestions to the author. The most recent version of the Catalyst Tutorial can be found at -L. +L. Copyright 2006-2008, Kennedy Clark, under Creative Commons License (L).