10 itkaclcommon::check_csrf_token();
12 my $parent = $itkaclcommon::cgi->param('parent');
13 my $name = $itkaclcommon::cgi->param('name');
14 my $description = $itkaclcommon::cgi->param('description');
16 if ($name !~ /^[a-zA-Z0-9-]+$/) {
17 die "Illegal characters in name";
19 if (length($name) > 64) {
23 $itkaclcommon::dbh->do('INSERT INTO objects (name,description,parent) VALUES (?,?,?)', undef,
24 $name, $description, $parent)
25 or die "Couldn't insert new object";
27 # Let sync-itkacl know there's updates
28 utime(time(), time(), '/etc/itkacl/updated');
31 # Redirect to the newly created node (a little touch: make sure the node
32 # is opened so the new node is visible in the tree -- this won't catch all
33 # cases, but at least most of them).
35 my $ref = $itkaclcommon::dbh->selectrow_hashref('SELECT id FROM objects WHERE name=? AND parent=?',
36 undef, $name, $parent);
38 print $itkaclcommon::cgi->redirect("view.pl?entry=$ref->{'id'}&open=$parent");