Add the bare minimum of what is required for the web interface to work (but be butt...
[itkacl] / itkacl-web-1.0 / web / add.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
11 my $allow = $itkaclcommon::cgi->param('allow');
12 my $entry = $itkaclcommon::cgi->param('entry');
13 my $entity = $itkaclcommon::cgi->param('entity');
14 my $entity_type = $itkaclcommon::cgi->param('entity_type');
15 my $comment = $itkaclcommon::cgi->param('comment');
16
17 $itkaclcommon::dbh->do('INSERT INTO aclentries (allow,object,entity_type,entity,comment) VALUES (?,?,?,?,?)', undef,
18     $allow, $entry, $entity_type, $entity, $comment)
19         or die "Couldn't add new ACL entry";
20
21 # Let sync-itkacl know there's updates
22 utime(time(), time(), '/etc/itkacl/updated');
23         
24 print $itkaclcommon::cgi->redirect("view.pl?entry=$entry");
25