Changeset 275 for trunk/dns.cgi


Ignore:
Timestamp:
03/15/12 15:34:38 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Convert domStatus() and caller to zoneStatus() for reverse DNS
Add status change to revzones page handling
See #26

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r274 r275  
    315315# hmm.  seeing problems in some possibly-not-so-corner cases.
    316316# this currently only handles "domain on", "domain off"
    317   if (defined($webvar{domstatus})) {
     317  if (defined($webvar{zonestatus})) {
    318318    # security check - does the user have permission to access this entity?
    319319    my $flag = 0;
     
    322322    }
    323323    if ($flag && ($permissions{admin} || $permissions{domain_edit})) {
    324       my $stat = domStatus($dbh,$webvar{id},$webvar{domstatus});
     324      my $stat = zoneStatus($dbh,$webvar{id},'n',$webvar{zonestatus});
    325325##fixme  switch to more consise "Enabled <domain"/"Disabled <domain>" as with users?
    326326      logaction($webvar{id}, $session->param("username"),
     
    332332      $page->param(errmsg => "You are not permitted to view or change the requested domain");
    333333    }
    334     $uri_self =~ s/\&amp;domstatus=[^&]*//g;    # clean up URL for stuffing into templates
     334    $uri_self =~ s/\&amp;zonestatus=[^&]*//g;   # clean up URL for stuffing into templates
    335335  }
    336336
     
    434434
    435435  $webvar{revrec} = 'y';
     436
     437  if (defined($webvar{zonestatus})) {
     438    # security check - does the user have permission to access this entity?
     439    my $flag = 0;
     440    foreach (@viewablegroups) {
     441      $flag = 1 if isParent($dbh, $_, 'group', $webvar{id}, 'revzone');
     442    }
     443    if ($flag && ($permissions{admin} || $permissions{domain_edit})) {
     444      my $stat = zoneStatus($dbh,$webvar{id},'y',$webvar{zonestatus});
     445##fixme  switch to more consise "Enabled <domain"/"Disabled <domain>" as with users?
     446      logaction($webvar{id}, $session->param("username"),
     447        parentID($dbh, (id => $webvar{id}, type => 'revzone', revrec => $webvar{revrec})),
     448        "Changed ".revName($dbh, $webvar{id})." state to ".($stat ? 'active' : 'inactive'));
     449      $page->param(resultmsg => "Changed ".revName($dbh, $webvar{id})." state to ".
     450        ($stat ? 'active' : 'inactive'));
     451    } else {
     452      $page->param(errmsg => "You are not permitted to view or change the requested reverse zone");
     453    }
     454    $uri_self =~ s/\&amp;zonestatus=[^&]*//g;   # clean up URL for stuffing into templates
     455  }
    436456
    437457  if ($session->param('resultmsg')) {
     
    12221242      $row{domain} = domainName($dbh,$webvar{$_});
    12231243##fixme:  error handling on status change
    1224       my $stat = domStatus($dbh,$webvar{$_},($webvar{bulkaction} eq 'activate' ? 'domon' : 'domoff'));
     1244      my $stat = zoneStatus($dbh,$webvar{$_},($webvar{bulkaction} eq 'activate' ? 'domon' : 'domoff'));
    12251245      logaction($webvar{$_}, $session->param("username"),
    12261246        parentID($dbh, (id => $webvar{$_}, type => 'domain', revrec => $webvar{revrec})),
     
    16371657      my %row;
    16381658      my ($code,$msg) = importAXFR($dbh, $webvar{ifrom}, $domain, $webvar{group},
    1639         $webvar{domstatus}, $webvar{rwsoa}, $webvar{rwns});
     1659        $webvar{zonestatus}, $webvar{rwsoa}, $webvar{rwns});
    16401660      $row{domok} = $msg if $code eq 'OK';
    16411661      if ($code eq 'WARN') {
Note: See TracChangeset for help on using the changeset viewer.