<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,17 +1,17 @@
-&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
-&lt;!-- Komodo Project File - DO NOT EDIT --&gt;
-&lt;project id=&quot;b72b9183-37e2-407e-9b95-ec64ccfca0e5&quot; kpf_version=&quot;4&quot; name=&quot;Mango.kpf&quot;&gt;
-&lt;preference-set idref=&quot;b72b9183-37e2-407e-9b95-ec64ccfca0e5&quot;&gt;
-  &lt;string id=&quot;import_exclude_matches&quot;&gt;*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store;blib;inc;Makefile;var&lt;/string&gt;
-  &lt;boolean id=&quot;import_recursive&quot;&gt;1&lt;/boolean&gt;
-  &lt;string id=&quot;rubyExtraPaths&quot;&gt;&lt;/string&gt;
-  &lt;string id=&quot;phpExtraPaths&quot;&gt;&lt;/string&gt;
-  &lt;string id=&quot;pythonExtraPaths&quot;&gt;&lt;/string&gt;
-  &lt;string relative=&quot;path&quot; id=&quot;perlExtraPaths&quot;&gt;lib:/home/claco/CPAN/Mango/t/lib:/home/claco/CPAN/Mango/inc:/Users/claco/Documents/Mango/t/lib;C:/Development/CPAN/Mango/lib&lt;/string&gt;
-  &lt;boolean id=&quot;import_live&quot;&gt;1&lt;/boolean&gt;
-  &lt;string id=&quot;import_type&quot;&gt;useFolders&lt;/string&gt;
-  &lt;string id=&quot;mappedPaths&quot;&gt;&lt;/string&gt;
-  &lt;string id=&quot;import_include_matches&quot;&gt;&lt;/string&gt;
-  &lt;string id=&quot;javascriptExtraPaths&quot;&gt;&lt;/string&gt;
-&lt;/preference-set&gt;
-&lt;/project&gt;
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;!-- Komodo Project File - DO NOT EDIT --&gt;
+&lt;project id=&quot;b72b9183-37e2-407e-9b95-ec64ccfca0e5&quot; kpf_version=&quot;4&quot; name=&quot;Mango.kpf&quot;&gt;
+&lt;preference-set idref=&quot;b72b9183-37e2-407e-9b95-ec64ccfca0e5&quot;&gt;
+  &lt;string id=&quot;import_exclude_matches&quot;&gt;*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store;blib;inc;Makefile;var&lt;/string&gt;
+  &lt;boolean id=&quot;import_recursive&quot;&gt;1&lt;/boolean&gt;
+  &lt;string id=&quot;rubyExtraPaths&quot;&gt;&lt;/string&gt;
+  &lt;string id=&quot;phpExtraPaths&quot;&gt;&lt;/string&gt;
+  &lt;string id=&quot;pythonExtraPaths&quot;&gt;&lt;/string&gt;
+  &lt;string relative=&quot;path&quot; id=&quot;perlExtraPaths&quot;&gt;lib:/home/claco/CPAN/Mango/t/lib:/home/claco/CPAN/Mango/inc:/Users/claco/Documents/Mango/t/lib:/Development/CPAN/Mango/lib&lt;/string&gt;
+  &lt;boolean id=&quot;import_live&quot;&gt;1&lt;/boolean&gt;
+  &lt;string id=&quot;import_type&quot;&gt;useFolders&lt;/string&gt;
+  &lt;string id=&quot;mappedPaths&quot;&gt;&lt;/string&gt;
+  &lt;string id=&quot;import_include_matches&quot;&gt;&lt;/string&gt;
+  &lt;string id=&quot;javascriptExtraPaths&quot;&gt;&lt;/string&gt;
+&lt;/preference-set&gt;
+&lt;/project&gt;</diff>
      <filename>Mango.kpf</filename>
    </modified>
    <modified>
      <diff>@@ -121,6 +121,10 @@ sub add_config {
     $config-&gt;{'default_view'} = 'XHTML';
     $config-&gt;{'authorization'}-&gt;{'mango'}-&gt;{'admin_role'} = $self-&gt;{'adminrole'};
 
+$config-&gt;{cache}-&gt;{backend} = {
+        store =&gt; &quot;Memory&quot;,
+};
+
     YAML::DumpFile($file, $config);
 
     return;</diff>
      <filename>lib/Catalyst/Helper/Mango.pm</filename>
    </modified>
    <modified>
      <diff>@@ -12,12 +12,14 @@ sub _parse_PathPrefix_attr {
     return PathPart =&gt; $self-&gt;path_prefix;
 };
 
-sub page {
-    return shift-&gt;context-&gt;request-&gt;param('page') || 1;
+sub current_page {
+    my $c = shift-&gt;context;
+    return $c-&gt;request-&gt;param('current_page') || 1;
 };
 
-sub rows {
-    return shift-&gt;context-&gt;request-&gt;param('rows') || 10;
+sub entries_per_page {
+    my $c = shift-&gt;context;
+    return $c-&gt;request-&gt;param('entries_per_page') || 10;
 };
 
 1;
\ No newline at end of file</diff>
      <filename>lib/Mango/Catalyst/Controller.pm</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@ use warnings;
 BEGIN {
     use base qw/Catalyst::Controller::REST/;
     use MIME::Types;
+    use Scalar::Util qw/blessed/;
 };
 
 __PACKAGE__-&gt;config(
@@ -78,10 +79,18 @@ sub begin : Private {
 };
 
 sub entity {
-    my ($self, $data) = @_;
+    my ($self, $data, $pager) = @_;
     my $key = $self-&gt;{'serialize'}-&gt;{'stash_key'};
 
     if (defined $data) {
+        if (blessed $pager &amp;&amp; $pager-&gt;isa('Data::Page')) {
+            $data-&gt;{'current_page'}     = $pager-&gt;current_page;
+            $data-&gt;{'entries_per_page'} = $pager-&gt;entries_per_page;
+            $data-&gt;{'total_entries'}    = $pager-&gt;total_entries;
+            $data-&gt;{'first_page'}       = $pager-&gt;first_page;
+            $data-&gt;{'last_page'}        = $pager-&gt;last_page;
+        };
+
         $self-&gt;context-&gt;stash-&gt;{$key} = $data;
     };
 </diff>
      <filename>lib/Mango/Catalyst/Controller/REST.pm</filename>
    </modified>
    <modified>
      <diff>@@ -31,8 +31,8 @@ returns a collection of user data.
 sub index_GET : Private {
     my ($self, $c) = @_;
     my $users = $c-&gt;model('Users')-&gt;search(undef, {
-        page =&gt; $self-&gt;page,
-        rows =&gt; $self-&gt;rows
+        page =&gt; $self-&gt;current_page,
+        rows =&gt; $self-&gt;entries_per_page
     });
     my $pager = $users-&gt;pager;
 
@@ -46,7 +46,7 @@ sub index_GET : Private {
 
         $self-&gt;entity({
             users =&gt; \@users
-        });
+        }, $pager);
     };
 };
 </diff>
      <filename>lib/Mango/Catalyst/Controller/Users.pm</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,8 @@ BEGIN {
         Mango::Catalyst::Plugin::Authentication
         Mango::Catalyst::Plugin::I18N
         Mango::Catalyst::Plugin::Forms
+        Catalyst::Plugin::Cache
+        Catalyst::Plugin::Cache::Store::Memory
     /;
 };
 </diff>
      <filename>lib/Mango/Catalyst/Plugin/Application.pm</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ use warnings;
 our $VERSION = $Mango::VERSION;
 
 BEGIN {
-    use base qw/Catalyst::Plugin::Authentication/;
+    use base qw/Catalyst::Plugin::Authentication Catalyst::Plugin::Authentication::Credential::HTTP/;
 
     use Mango ();
     use Mango::I18N ();
@@ -41,9 +41,10 @@ sub is_admin {
 sub unauthorized {
     my $c = shift;
 
-        $c-&gt;response-&gt;status(401);
-        $c-&gt;stash-&gt;{'template'} = 'errors/401';
-        $c-&gt;detach;
+    $c-&gt;response-&gt;status(401);
+    $c-&gt;stash-&gt;{'template'} = 'errors/401';
+    $c-&gt;authorization_required(realm =&gt; $c-&gt;config-&gt;{'authentication'}-&gt;{'default_realm'});
+    $c-&gt;detach;
 };
 
 1;</diff>
      <filename>lib/Mango/Catalyst/Plugin/Authentication.pm</filename>
    </modified>
    <modified>
      <diff>@@ -44,26 +44,71 @@ BEGIN {
 };
 
 
-## index is only allowed in html/xhtml/text
+## GET /users
 {
     my $m = Test::WWW::Mechanize::Catalyst-&gt;new;
 
-    ## using friendly view name
+    ## REST using friendly view name
     my $r = $m-&gt;get('/users/?view=yaml');
-    is($r-&gt;code, 400);
+    is($r-&gt;code, 200);
     is($r-&gt;header('Content-Type'), 'text/x-yaml');
-    diag $r-&gt;content;
+    is_deeply(YAML::Load($r-&gt;content), {
+        users =&gt; [
+            {id =&gt; 1, username =&gt; 'admin'}
+        ],
+        current_page =&gt; 1,
+        entries_per_page =&gt; 10,
+        total_entries =&gt; 1,
+        first_page =&gt; 1,
+        last_page =&gt; 1
+    });
 
-    ## using content-type param
+    ## REST using content-type param
     $r = $m-&gt;get('/users/?content-type=text/x-yaml');
-    is($r-&gt;code, 400);
+    is($r-&gt;code, 200);
     is($r-&gt;header('Content-Type'), 'text/x-yaml');
-    diag $r-&gt;content;
+    is_deeply(YAML::Load($r-&gt;content), {
+        users =&gt; [
+            {id =&gt; 1, username =&gt; 'admin'}
+        ],
+        current_page =&gt; 1,
+        entries_per_page =&gt; 10,
+        total_entries =&gt; 1,
+        first_page =&gt; 1,
+        last_page =&gt; 1
+    });
 
-    ## using Content-Type header
+    ## REST using Content-Type header
     $m-&gt;add_header('Content-Type', 'text/x-yaml');
     $r = $m-&gt;get('/users/');
-    is($r-&gt;code, 400);
+    is($r-&gt;code, 200);
     is($r-&gt;header('Content-Type'), 'text/x-yaml');
-    diag $r-&gt;content;
+    is_deeply(YAML::Load($r-&gt;content), {
+        users =&gt; [
+            {id =&gt; 1, username =&gt; 'admin'}
+        ],
+        current_page =&gt; 1,
+        entries_per_page =&gt; 10,
+        total_entries =&gt; 1,
+        first_page =&gt; 1,
+        last_page =&gt; 1
+    });
 };
+
+
+## POST /users
+{
+    my $m = Test::WWW::Mechanize::Catalyst-&gt;new;
+    
+#$m-&gt;credentials( 'localhost:3000', $realm, $uname, $pass )
+
+    ## access denied for anonymous users
+    my $r = $m-&gt;post('/users/?view=yaml');
+    diag $r-&gt;as_string;
+    is($r-&gt;code, 401);
+    is($r-&gt;header('Content-Type'), 'text/x-yaml');
+};
+
+
+
+</diff>
      <filename>t/catalyst/live_rest_users.t</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6045c3ac40244838f5763d3ecf260b4087891dc7</id>
    </parent>
  </parents>
  <author>
    <name>claco</name>
    <email>claco@52a70e3a-55ec-0310-b14e-7917f69ecacc</email>
  </author>
  <url>http://github.com/claco/mango/commit/affdd1edc23110ebdd8679a2754e66d31a5787ab</url>
  <id>affdd1edc23110ebdd8679a2754e66d31a5787ab</id>
  <committed-date>2007-11-08T19:42:18-08:00</committed-date>
  <authored-date>2007-11-08T19:42:18-08:00</authored-date>
  <message> r2001@mbp:  claco | 2007-11-08 22:44:18 -0500
 Added HTTP Auth to unauthorized
 REST-&gt;entity now takes $pager param


git-svn-id: http://svn.icantfocus.com/CPAN/Mango/trunk@1990 52a70e3a-55ec-0310-b14e-7917f69ecacc</message>
  <tree>76e49463187cbf353307d51beda3c223eb93addb</tree>
  <committer>
    <name>claco</name>
    <email>claco@52a70e3a-55ec-0310-b14e-7917f69ecacc</email>
  </committer>
</commit>
