Changeset 192


Ignore:
Timestamp:
12/09/11 16:17:14 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Ooops, reverting unintended Weirdness in dns.sql, DNSDB.pm, and dns.cgi
accidentally commited along with the intended dns-rpc.cgi change in r191

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r191 r192  
    487487# Log an action
    488488# Internal sub
    489 # Takes a database handle, domain_id, group_id, log entry, and user info hash
    490 # User info must contain a user ID OR username+fullname
     489# Takes a database handle, domain_id, user_id, group_id, email, name and log entry
    491490sub _log {
    492491  my $dbh = shift;
    493492  my ($domain_id,$user_id,$group_id,$username,$name,$entry) = @_;
    494 
    495 ##fixme:  need better way(s?) to snag userinfo for log entries
    496   if (!$user_id) {
    497     $user_id, $fullname) = $dbh->fetchrow_array("SELECT user_id, firstname || ' ' || lastname FROM users".
    498         " WHERE username=?", undef, ($username));
    499   } elsif (!$username) {
    500     $username, $fullname) = $dbh->fetchrow_array("SELECT username, firstname || ' ' || lastname FROM users".
    501         " WHERE user_id=?", undef, ($user_id));
    502   }
    503 
    504   $name = $fullname if !$name;
    505493
    506494##fixme:  farm out the actual logging to different subs for file, syslog, internal, etc based on config
     
    558546  local $dbh->{RaiseError} = 1;
    559547
     548my $stage = 'insert';
    560549  # Wrap all the SQL in a transaction
    561550  eval {
    562551    # insert the domain...
    563552    $dbh->do("INSERT INTO domains (domain,group_id,status) VALUES (?,?,?)", undef, ($domain, $group, $state));
     553$stage = 'domid';
    564554
    565555    # get the ID...
    566556    ($dom_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE domain=?", undef, ($domain));
    567557
     558$stage = 'loginsert';
    568559    _log($dbh, $dom_id, $userinfo{id}, $group, $userinfo{name}, $userinfo{fullname},
    569560        "Added ".($state ? 'active' : 'inactive')." domain $domain");
    570561
     562$stage = 'getdefrec';
    571563    # ... and now we construct the standard records from the default set.  NB:  group should be variable.
    572564    my $sth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl FROM default_records WHERE group_id=?");
     
    600592    my $msg = $@;
    601593    eval { $dbh->rollback; };
    602     return ('FAIL',$msg);
     594    return ('FAIL',"$msg : $stage");
    603595  } else {
    604596    return ('OK',$dom_id);
  • trunk/dns.cgi

    r191 r192  
    347347
    348348  if ($code eq 'OK') {
    349 #    logaction($msg, $session->param("username"), $webvar{group}, "Added domain $webvar{domain}");
     349    logaction($msg, $session->param("username"), $webvar{group}, "Added domain $webvar{domain}");
    350350    changepage(page => "reclist", id => $msg);
    351351  } else {
  • trunk/dns.sql

    r191 r192  
    184184\.
    185185
    186 -- ennnhhh...  do we want to create superusers by default?  may save going back to the DB to manually readd one
    187186CREATE TABLE users (
    188187    user_id serial NOT NULL,
Note: See TracChangeset for help on using the changeset viewer.