Changeset 248


Ignore:
Timestamp:
02/28/12 17:11:56 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Quick pass over log linking and display for reverse zones. See #26.
Also add a ##fixme in logaction() for pagination, filtering, and
other log data massaging.

Fix a couple of typos introduced by hand-applying unrelated fixes
in a separate working copy

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r246 r248  
    18271827  my $dbh = shift;
    18281828  my $defrec = shift;
    1829   my $reverc = shift;
     1829  my $revrec = shift;
    18301830
    18311831  my %soa = @_;
    18321832
    18331833##fixme: data validation: make sure {recid} is really the SOA for {parent}
    1834   my $sql = "UPDATE "_rectable($defrec, $revrec)." SET host=?, val=?, ttl=? WHERE record_id=? AND type=6";
    1835   $sth = $dbh->prepare($sql);
    1836   $sth->execute("$soa{contact}:$soa{prins}", "$soa{refresh}:$soa{retry}:$soa{expire}:$soa{minttl}",
    1837         $soa{ttl}, $soa{recid});
     1834  my $sql = "UPDATE "._rectable($defrec, $revrec)." SET host=?, val=?, ttl=? WHERE record_id=? AND type=6";
     1835  $dbh->do($sql, undef, ("$soa{contact}:$soa{prins}", "$soa{refresh}:$soa{retry}:$soa{expire}:$soa{minttl}",
     1836        $soa{ttl}, $soa{recid}));
    18381837
    18391838} # end updateSOA()
  • trunk/dns.cgi

    r247 r248  
    493493    $page->param(defrec => $webvar{defrec});
    494494    showzone($webvar{defrec}, $webvar{revrec}, $webvar{id});
    495     if ($webvar{defrec} eq 'y') {
    496     } else {
     495    if ($webvar{defrec} eq 'n') {
    497496#      showzone('n',$webvar{id});
    498497##fixme:  permission for viewing logs?
    499498##fixme:  determine which slice of the log we view (group, domain, revzone)
    500       $page->param(logdom => 1);
     499      if ($webvar{revrec} eq 'n') {
     500        $page->param(logdom => 1);
     501      } else {
     502        $page->param(logrdns => 1);
     503      }
    501504    }
    502505
     
    523526  # security check - does the user have permission to access this entity?
    524527  if (!check_scope(id => $webvar{id}, type =>
    525         ($webvar{defrec} eq 'y' ? ($webvar{revrec eq 'y' ? 'defrevrec' : 'defrec') : 'record'))) {
     528        ($webvar{defrec} eq 'y' ? ($webvar{revrec} eq 'y' ? 'defrevrec' : 'defrec') : 'record'))) {
    526529    $page->param(perm_err => "You are not permitted to edit the requested record");
    527530    goto DONEREC;
     
    761764  # id is domain/revzone/group id
    762765  if (!check_scope(id => $webvar{id}, type =>
    763         ($webvar{defrec} eq 'y' ? 'group' : ($webvar{revrec} eq 'y' ? 'revzone' : 'domain'))) {
     766        ($webvar{defrec} eq 'y' ? 'group' : ($webvar{revrec} eq 'y' ? 'revzone' : 'domain')))) {
    764767    changepage(page => 'domlist', errmsg => "You do not have permission to edit the ".
    765768        ($webvar{defrec} eq 'y' ? 'default ' : '')."SOA record for the requested ".
     
    15971600    }
    15981601    $page->param(logfor => 'domain '.domainName($dbh,$id));
     1602  } elsif ($webvar{ltype} && $webvar{ltype} eq 'rdns') {
     1603    $sql .= "rdns_id=?";
     1604    $id = $webvar{id};
     1605    if (!check_scope(id => $id, type => 'revzone')) {
     1606      $page->param(errmsg => "You are not permitted to view log entries for the requested reverse zone");
     1607      goto DONELOG;
     1608    }
     1609    $page->param(logfor => 'reverse zone '.revName($dbh,$id));
    15991610  } else {
    16001611    # Default to listing curgroup log
     
    16041615    # group log is always for the "current" group
    16051616  }
     1617##fixme:
     1618# - filtering
     1619# - show reverse zone column?
     1620# - pagination/limiting number of records - put newest-first so user
     1621#   doesn't always need to go to the last page for recent activity?
    16061622  my $sth = $dbh->prepare($sql);
    16071623  $sth->execute($id);
  • trunk/templates/reclist.tmpl

    r235 r248  
    5050        <td colspan="4">Records</td>
    5151<TMPL_IF record_create> <td align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=record&amp;parentid=<TMPL_VAR NAME=id>&amp;defrec=<TMPL_VAR NAME=defrec>&amp;revrec=<TMPL_VAR NAME=revrec>&amp;recact=new">Add record</a></td></TMPL_IF>
    52         <td align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=log&amp;id=<TMPL_VAR NAME=id><TMPL_IF logdom>&amp;ltype=dom</TMPL_IF>">View log</a></td>
     52        <td align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=log&amp;id=<TMPL_VAR NAME=id><TMPL_IF logdom>&amp;ltype=dom</TMPL_IF><TMPL_IF logrdns>&amp;ltype=rdns</TMPL_IF>">View log</a></td>
    5353</tr>
    5454
Note: See TracChangeset for help on using the changeset viewer.