Changeset 260 for trunk/dns.cgi


Ignore:
Timestamp:
03/02/12 17:51:29 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

First pass adding add-reverse-zone.

  • add newrdns/addrdns templates
  • add handling in dns.cgi for pages, copy-paste-modify'ed from add-domain
  • add addRDNS() in DNSDB.pm, copy-paste-modify'ed from addDomain()

addRDNS() still needs extension at the ##work to properly substitute
ZONE in hostname and value fields as well as pick and choose default
records (ie, skip A+PTR in v6 zones, and skip AAAA+PTR in v4 zones)
See #26

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r259 r260  
    426426  $page->param(curpage => $webvar{page});
    427427  listzones();
     428
     429} elsif ($webvar{page} eq 'newrevzone') {
     430
     431## scope/access check - use domain settings?  invent new (bleh)
     432  changepage(page => "revzones", errmsg => "You are not permitted to add reverse zones")
     433       unless ($permissions{admin} || $permissions{domain_create});
     434
     435  fill_grouplist("grouplist");
     436
     437  if ($webvar{add_failed}) {
     438    $page->param(add_failed => 1);
     439    $page->param(errmsg => $webvar{errmsg});
     440    $page->param(revzone => $webvar{revzone});
     441    $page->param(revpatt => $webvar{revpatt});
     442  }
     443
     444} elsif ($webvar{page} eq 'addrevzone') {
     445
     446  changepage(page => "revzones", errmsg => "You are not permitted to add reverse zones")
     447       unless ($permissions{admin} || $permissions{domain_create});
     448
     449  # security check - does the user have permission to access this entity?
     450  if (!check_scope(id => $webvar{group}, type => 'group')) {
     451    changepage(page => "newrevzone", add_failed => 1, revzone => $webvar{revzone}, revpatt => $webvar{revpatt},
     452       errmsg => "You do not have permission to add a reverse zone to the requested group");
     453  }
     454
     455  my ($code,$msg) = addRDNS($dbh, $webvar{revzone}, $webvar{revpatt}, $webvar{group},
     456        ($webvar{makeactive} eq 'on' ? 1 : 0),
     457        (username => $session->param("username"), id => $session->param("uid")) );
     458
     459  if ($code eq 'OK') {
     460    logaction(0, $session->param("username"), $webvar{group}, "Added reverse zone $webvar{revzone}", $msg);
     461    changepage(page => "reclist", id => $msg, revrec => 'y');
     462  } else {
     463    logaction(0, $session->param("username"), $webvar{group}, "Failed adding reverse zone $webvar{revzone} ($msg)");
     464    changepage(page => "newrevzone", add_failed => 1, revzone => $webvar{revzone}, revpatt => $webvar{revpatt},
     465       errmsg => $msg);
     466  }
     467
     468#} elsif ($webvar{page} eq 'delrevzone') {
    428469
    429470} elsif ($webvar{page} eq 'reclist') {
Note: See TracChangeset for help on using the changeset viewer.