From 1afeddc08f6c61cff204980cfae93d97320ae39f Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 14 Jan 2006 17:25:35 +0000 Subject: aggiornamento a nuovo Catalyst, e "permessi di scrittura" (orendo) --- lib/Bookmarks.pm | 4 ++-- lib/Bookmarks/C/Main.pm | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Bookmarks.pm b/lib/Bookmarks.pm index 89aa0c9..bc4694b 100644 --- a/lib/Bookmarks.pm +++ b/lib/Bookmarks.pm @@ -1,14 +1,14 @@ package Bookmarks; use strict; -use Catalyst qw/Prototype DefaultEnd Static::Simple/; +use Catalyst qw/-Debug Prototype DefaultEnd Static::Simple/; use HTML::Element; our $VERSION = '0.01'; Bookmarks->config( name => 'Bookmarks', - 'Bookmarks::View::TT' => { + 'V::TT' => { TIMER => 0, }, ); diff --git a/lib/Bookmarks/C/Main.pm b/lib/Bookmarks/C/Main.pm index d64f2fd..1039ade 100644 --- a/lib/Bookmarks/C/Main.pm +++ b/lib/Bookmarks/C/Main.pm @@ -87,6 +87,12 @@ sub jump : Global { sub add : Global { my ( $self, $c ) = @_; + unless ($self->_authorized($c)) { + $c->res->status(403); + $c->res->body('non puoi'); + return; + } + my %pre_link=(); for my $field (qw(pk url title descr)) { $pre_link{$field}=$c->req->param($field); @@ -167,6 +173,12 @@ sub add : Global { sub edit : Global { my ( $self, $c ) = @_; + unless ($self->_authorized($c)) { + $c->res->status(403); + $c->res->body('non puoi'); + return; + } + my $link=Bookmarks::M::DB::Links->retrieve($c->req->param('link')); $c->stash->{link}=$link; @@ -198,6 +210,15 @@ sub search : Global { $c->stash->{template}='results'; } +sub _authorized { + my ($self,$c)=@_; + + if ($ENV{BOOKMARKS_CAN_EDIT}) { + return 1; + } + return; +} + =head1 AUTHOR A clever guy -- cgit v1.2.3