X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FAuthorization.pod;h=331325b3dc03817eefbb956feb2bdc8b60bd8f8d;hp=f889bde21e66f6cfcd57fe0c1fdffb87e8041350;hb=956740865aa337085c506d81d41e4f69f892bff2;hpb=905a3a26761669e7c4fd80daa50034eaa3375b50 diff --git a/lib/Catalyst/Manual/Tutorial/Authorization.pod b/lib/Catalyst/Manual/Tutorial/Authorization.pod index f889bde..331325b 100644 --- a/lib/Catalyst/Manual/Tutorial/Authorization.pod +++ b/lib/Catalyst/Manual/Tutorial/Authorization.pod @@ -125,9 +125,6 @@ C and C definitions are new): # NOTE: Omit 'MyApp::Model' here just as you would when using # '$c->model("DB::Users)' user_class DB::Users - # This is the name of the field in your 'users' table that - # contains the user's name - id_field username # This is the name of a many_to_many relation in the users # object that points to the roles for that user role_relation roles @@ -145,25 +142,25 @@ C and C definitions are new): Open C in your editor and add the following lines to the bottom of the file: -

Hello [% Catalyst.user.username %], you have the following roles:

+

Hello [% c.user.username %], you have the following roles:

    [% # Dump list of roles -%] - [% FOR role = Catalyst.user.roles %]
  • [% role %]
  • [% END %] + [% FOR role = c.user.roles %]
  • [% role %]
  • [% END %]

[% # Add some simple role-specific logic to template %] [% # Use $c->check_user_roles() to check authz -%] - [% IF Catalyst.check_user_roles('user') %] + [% IF c.check_user_roles('user') %] [% # Give normal users a link for 'logout' %] - Logout + Logout [% END %] [% # Can also use $c->user->check_roles() to check authz -%] - [% IF Catalyst.check_user_roles('admin') %] + [% IF c.check_user_roles('admin') %] [% # Give admin users a link for 'create' %] - Create + Create [% END %]

@@ -415,5 +412,5 @@ most recent version of the Catalyst Tutorial can be found at L. Copyright 2006-2008, Kennedy Clark, under Creative Commons License -(L). +(L).