Changeset 416 for trunk/cgi-bin/main.cgi


Ignore:
Timestamp:
05/18/10 18:08:12 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

Update mailNotify to use new table notify to decide who to spam
with notices on various events. See #2.

  • existing notification calls updated. Still need to move calls into IPDB.pm's subs
  • IPDB.pm and MyIPDB.pm updated with new semiglobal vars for org name, SMTP host, domain. Will add others as needed so MyIPDB.pm can be moved to /etc/ipdb/ (see #17).

Internal allocation types will need to be rearranged somewhat to
make full use of the flexibility possible. See #20.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r415 r416  
    890890                qq(&ipdb=1&ip=$msg">Add this IP to RADIUS user table</a></div>)
    891891        : "</div>");
    892       # Notify tech@example.com
    893 #      mailNotify('tech@example.com',"ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
    894 #       "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
    895 #       "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
     892      mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
     893        "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
     894        "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
    896895    } else {
    897896      my $netblock = new NetAddr::IP $webvar{fullcidr};
     
    905904                qq(">Add this netblock to RADIUS user table</a></div>)
    906905        : "</div>");
    907 #      mailNotify('nocmgr@example.com',"ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
    908 #       "$disp_alloctypes{$webvar{alloctype}} $webvar{fullcidr} allocated to customer $webvar{custid}\n".
    909 #       "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
     906      mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
     907        "$disp_alloctypes{$webvar{alloctype}} $webvar{fullcidr} allocated to customer $webvar{custid}\n".
     908        "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
    910909    }
    911910    syslog "notice", "$authuser allocated '$webvar{fullcidr}' to '$webvar{custid}' as ".
     
    12241223  # If we get here, the operation succeeded.
    12251224  syslog "notice", "$authuser updated $webvar{block}";
    1226 #mailNotify('nocmgr@example.com',"SWIPed: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
    1227 #       "$webvar{block} had SWIP status changed to \"Yes\" by $authuser");
     1225##fixme:  need to wedge something in to allow "update:field" notifications
     1226## hmm.  how to tell what changed?  O_o
     1227mailNotify($ip_dbh, 'ua', "SWIPed: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
     1228        "$webvar{block} had SWIP status changed to \"Yes\" by $authuser") if $webvar{swip} eq 'on';
    12281229  open (HTML, "../updated.html")
    12291230        or croak "Could not open updated.html :$!";
     
    14011402    syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}".
    14021403        " $custid, $city, desc='$description'";
    1403     # Notify tech@ when a block/IP is deallocated
    1404 #    mailNotify('tech@example.com',"REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
    1405 #       "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
    1406 #       "CustID: $custid\nCity: $city\nDescription: $description\n");
    1407 #    mailNotify('nocmgr@example.com',"REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
    1408 #       "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
    1409 #       "CustID: $custid\nCity: $city\nDescription: $description\n");
     1404    mailNotify($ip_dbh, 'da', "REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
     1405        "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
     1406        "CustID: $custid\nCity: $city\nDescription: $description\n");
    14101407  } else {
    14111408    if ($webvar{alloctype} =~ /^.i$/) {
Note: See TracChangeset for help on using the changeset viewer.