]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Add sessioncgi hook.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 5 Aug 2007 21:38:27 +0000 (21:38 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 5 Aug 2007 21:38:27 +0000 (21:38 +0000)
IkiWiki/CGI.pm
debian/changelog
doc/plugins/write.mdwn
doc/todo/cgi_hooks_get_session_objects.mdwn

index 2150ea95bc8a24a1a0f4de8c247402b624f399aa..144ad2198ca1d4776e219df8a3049b7a4e35e03a 100644 (file)
@@ -688,7 +688,10 @@ sub cgi (;$$) { #{{{
                print gettext("You are banned.");
                cgi_savesession($session);
        }
-       elsif ($do eq 'signin') {
+
+       run_hooks(sessioncgi => sub { shift->($q, $session) });
+
+       if ($do eq 'signin') {
                cgi_signin($q, $session);
                cgi_savesession($session);
        }
index e5c259fcaf20f65f636f877aed5ae3dbe0da312f..0d40a2d2e538936e7d33800ab3a6aacccd392bf1 100644 (file)
@@ -9,8 +9,9 @@ ikiwiki (2.6) UNRELEASED; urgency=low
   * pagetemplate: don't display template name
   * Add rel=tag attribute to tag links, supporting that microformat, as well
     as allowing them to be styled specially. Thanks, NicolasLimare.
+  * Add sessioncgi hook. 
 
- -- Joey Hess <joeyh@debian.org>  Sun, 05 Aug 2007 13:35:37 -0700
+ -- Joey Hess <joeyh@debian.org>  Sun, 05 Aug 2007 14:36:55 -0700
 
 ikiwiki (2.5) unstable; urgency=low
 
index 90818c42e6777b58e862d366d2b6b4ae3cc86392..416f1b86e63cd8d68ddb0fa9eb34f5de9f5cf6d6 100644 (file)
@@ -208,6 +208,15 @@ object's "name" parameter to the authenticated user's name. Note that
 if the name is set to the name of a user who is not registered,
 a basic registration of the user will be automatically performed.
 
+### sessioncgi
+
+       hook(type => "sessioncgi", id => "foo", call => \&sessioncgi);
+
+Unlike the cgi hook, which is run as soon as possible, the sessioncgi hook
+is only run once a session object is available. It is passed both a CGI
+object and a session object. To check if the user is in fact signed in, you
+can check if the session object has a "name" parameter set.
+
 ### canedit
 
        hook(type => "canedit", id => "foo", call => \&pagelocked);
index c4bcdf1858f7ad04908fa500fd885a5f2a648644..edb9aba254721f0aeea7356da9f1f97025795893 100644 (file)
@@ -1,2 +1,5 @@
 How about a hook to allow CGI objects to insist on authenticated users 
-only? I think "authcgi" would be a good name. --Ethan
\ No newline at end of file
+only? I think "authcgi" would be a good name. --Ethan
+
+> This is now [[done]], although I called it sessioncgi since the user may
+> or may not be authed. --[[Joey]]