]> git.sesse.net Git - itkacl/blob - itkacl-web-1.0/web/deletenode.pl
Release a new version of the Apache module, with the context support.
[itkacl] / itkacl-web-1.0 / web / deletenode.pl
1 #! /usr/bin/perl -T
2 use strict;
3 use warnings;
4 use utf8;
5
6 use lib '../include';
7 use itkaclcommon;
8
9 itkaclcommon::init();
10 itkaclcommon::check_csrf_token();
11
12 my $entry = $itkaclcommon::cgi->param('entry');
13
14 # Find the parent node before we delete this (FIXME: this will fail badly
15 # for root nodes!)
16 my $ref = $itkaclcommon::dbh->selectrow_hashref('SELECT parent FROM objects WHERE id=?',
17         undef, $entry);
18
19 $itkaclcommon::dbh->do('DELETE FROM objects WHERE id=?', undef, $entry)
20         or die "Couldn't delete object";
21
22 # Let sync-itkacl know there's updates
23 utime(time(), time(), '/etc/itkacl/updated');
24
25 # Redirect to the parent
26 print $itkaclcommon::cgi->redirect("view.pl?entry=$ref->{'parent'}");
27