[Jifty-commit] r6995 - wifty/trunk/lib/Wifty
Jifty commits
jifty-commit at lists.jifty.org
Tue May 12 02:24:46 EDT 2009
Author: ruz
Date: Tue May 12 02:24:46 2009
New Revision: 6995
Modified:
wifty/trunk/lib/Wifty/Dispatcher.pm
Log:
* dispatch /admin, mention in the menu
Modified: wifty/trunk/lib/Wifty/Dispatcher.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Dispatcher.pm (original)
+++ wifty/trunk/lib/Wifty/Dispatcher.pm Tue May 12 02:24:46 2009
@@ -1,6 +1,9 @@
package Wifty::Dispatcher;
use Jifty::Dispatcher -base;
+use strict;
+use warnings;
+
# Generic restrictions
under '/', run {
Jifty->api->deny('ConfirmEmail');
@@ -11,16 +14,26 @@
$top->child( Home => url => "/", label => _("Home") );
$top->child( Recent => url => "/recent/changes", label => _("Recent Changes") );
$top->child( New => url => "/recent/additions", label => _("New") );
- if ( Jifty->web->current_user->id ) {
+ my $cu = Jifty->web->current_user;
+ if ( $cu->id ) {
$top->child(
Stats => url =>
- "/user/". Jifty->web->escape_uri(Jifty->web->current_user->username),
+ "/user/". Jifty->web->escape_uri($cu->username),
label => _("Stats"),
);
+ $top->child(
+ Admin => url => "/admin/", label => _("Administration"),
+ ) if $cu->user_object->admin;
}
$top->child( Search => url => "/search", label => _("Search") );
};
+before qr{^/admin\b}, run {
+ my $cu = Jifty->web->current_user;
+ abort(403) unless $cu->id;
+ abort(403) unless $cu->user_object->admin;
+};
+
# Default page
on '/', run {
redirect( '/view/HomePage');
More information about the Jifty-commit
mailing list