X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FAuthorization.pod;h=2162a856e6075fb1bcf2497754d9d514de2064f5;hb=7e5eb02c6b73fe449f282d5ac54f319463a46c3c;hp=d194e5e0dfc4074c96e6f26b1c13bd0ccfcd7d89;hpb=c19d127ebfc41407188cbb614c47635b312aad7e;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Manual/Tutorial/Authorization.pod b/lib/Catalyst/Manual/Tutorial/Authorization.pod index d194e5e..2162a85 100644 --- a/lib/Catalyst/Manual/Tutorial/Authorization.pod +++ b/lib/Catalyst/Manual/Tutorial/Authorization.pod @@ -110,7 +110,7 @@ Edit C and update it to match (everything from the # This is the model object created by Catalyst::Model::DBIC from your # schema (you created 'MyAppDB::User' but as the Catalyst startup # debug messages show, it was loaded as 'MyApp::Model::MyAppDB::User'). - # NOTE: Omit 'MyAppDB::Model' to avoid a component lookup issue in Catalyst 5.66 + # NOTE: Omit 'MyApp::Model' to avoid a component lookup issue in Catalyst 5.66 user_class: MyAppDB::User # This is the name of the field in your 'users' table that contains the user's name user_field: username @@ -126,7 +126,7 @@ Edit C and update it to match (everything from the # This is the model object created by Catalyst::Model::DBIC from your # schema (you created 'MyAppDB::Role' but as the Catalyst startup # debug messages show, it was loaded as 'MyApp::Model::MyAppDB::Role'). - # NOTE: Omit 'MyAppDB::Model' to avoid a component lookup issue in Catalyst 5.66 + # NOTE: Omit 'MyApp::Model' to avoid a component lookup issue in Catalyst 5.66 role_class: MyAppDB::Role # The name of the field in the 'roles' table that contains the role name role_field: role @@ -251,9 +251,10 @@ running) and restart it: Now trying going to L and you should be taken to the login page (you might have to C your -browser). Try logging in with both C and C (both use a -password of C) and notice how the roles information updates at -the bottom of the "Book List" page. Also try the C link on the +browser and/or click the "Logout" link on the book list page). Try +logging in with both C and C (both use a password +of C) and notice how the roles information updates at the +bottom of the "Book List" page. Also try the C link on the book list page. Now the "url_create" URL will work if you are already logged in as user @@ -266,12 +267,13 @@ while logged in as each user. Use one of the 'Logout' links (or go to L in you browser directly) when you are done. + =head1 ENABLE ACL-BASED AUTHORIZATION This section takes a brief look at how the -L plugin can automate much of the -work required to perform role-based authorization in a Catalyst -application. +L +plugin can automate much of the work required to perform role-based +authorization in a Catalyst application. =head2 Add the C Plugin @@ -305,7 +307,7 @@ C<__PACKAGE__-Esetup;> statement: Each of the three statements above comprises an ACL plugin "rule". The first two rules only allow admin-level users to create new books using the form (both the form itself and the data submission logic are -protected). The third statement allows both users and admin to delete +protected). The third statement allows both users and admins to delete books. The C action will continue to be protected by the "manually configured" authorization created earlier in this part of the tutorial. @@ -359,7 +361,7 @@ C B the C<__PACKAGE__-Esetup;> line. =head2 Add a Method to Handle Access Violations By default, -L +L throws an exception when authorization fails. This will take the user to the Catalyst debug screen, or a "Please come back later" message if you are not using the C<-Debug> flag. This step uses the @@ -380,12 +382,11 @@ following method: # Set the error message $c->stash->{error_msg} = 'Unauthorized!'; - + # Display the list $c->forward('list'); } - Then run the Catalyst development server script: $ script/myapp_server.pl @@ -411,5 +412,3 @@ Please report any errors, issues or suggestions to the author. Copyright 2006, Kennedy Clark, under Creative Commons License (L). -Version: .94 -