Ignore:
Timestamp:
08/14/25 18:06:51 (10 hours ago)
Author:
Kris Deugau
Message:

/branches/secondaryzones

Complete basic secondary zone add
Fix a minor missing piece filling the newsecondary template
Normalize form field names in the newsecondary template

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/secondaryzones/dns.cgi

    r922 r924  
    649649    $session->clear('errmsg');
    650650    $page->param(zone => $webvar{zone});
     651    $page->param(primary => $webvar{primary});
    651652    $page->param(addinactive => $webvar{makeactive} eq 'n');
     653  }
     654
     655} elsif ($webvar{page} eq 'addsecondary') {
     656
     657  changepage(page => "secondaryzones", errmsg => "You are not permitted to add secondary zones")
     658        unless ($permissions{admin} || $permissions{domain_create});
     659
     660  # security check - does the user have permission to access this entity?
     661  if (!check_scope(id => $webvar{group}, type => 'group')) {
     662    $session->param('add_failed', 1);
     663##fixme:  zone a security risk for XSS?
     664    changepage(page => "newsecondary", zone => $webvar{zone},
     665        errmsg => "You do not have permission to add a secondary zone to the requested group");
     666  }
     667
     668  $webvar{makeactive} = 0 if !defined($webvar{makeactive});
     669
     670  my ($code,$msg) = $dnsdb->addSecondary($webvar{zone}, $webvar{group}, $webvar{primary}, ($webvar{makeactive} eq 'on' ? 1 : 0),
     671        $webvar{defloc});
     672
     673  if ($code eq 'OK') {
     674    $webvar{zone} = lc($webvar{zone}) if $dnsdb->{lowercase};
     675    $dnsdb->mailNotify("New secondary zone created",
     676        ($webvar{makeactive} eq 'on' ? 'Active' : 'Inactive').qq( secondary zone "$webvar{zone}" added by ).
     677        $session->param("username"));
     678    changepage(page => "secondaryzones", id => $msg);
     679  } else {
     680    $session->param('add_failed', 1);
     681##fixme:  zone a security risk for XSS?
     682    changepage(page => "newsecondary", errmsg => $msg, zone => $webvar{zone}, primary => $webvar{primary},
     683        group => $webvar{group}, makeactive => ($webvar{makeactive} ? 'y' : 'n'), defloc => $webvar{defloc});
    652684  }
    653685
Note: See TracChangeset for help on using the changeset viewer.