Changeset 788
- Timestamp:
- 10/08/15 17:49:27 (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r785 r788 1841 1841 my ($code,$rmsg) = initPool($dbh, "$newblock", $binfo->{type}, $binfo->{city}, 'normal', $args{block}); 1842 1842 die $rmsg if $code eq 'FAIL'; 1843 } 1844 } 1845 1846 # check on the backup data first. we may need to tweak the main update's parameters. 1847 if (!defined($args{ignorebk})) { 1848 if ($args{backupfields}) { 1849 my @bkfields; 1850 my @bkvals; 1851 for my $bk (qw(brand model type src user vpass epass)) { 1852 if ($binfo->{"bk$bk"} ne $args{"bk$bk"}) { 1853 push @bkfields, "bk$bk = ?"; 1854 push @bkvals, $args{"bk$bk"}; 1855 } 1856 } 1857 $dbh->do("UPDATE backuplist SET ".join(',', @bkfields)." WHERE backup_id = ?", 1858 undef, @bkvals, $binfo->{hasbk}) 1859 if @bkfields; 1860 ##todo: keep historic changes for $timeperiod, by adding a backref ID field, and on updates adding a new backup 1861 # record instead of updating the existing one. should probably check if new==old so we don't do needless updates 1862 # in that case... 1863 } else { 1864 if ($binfo->{hasbk}) { 1865 # had backup data, no longer checked - delete backup entry 1866 $dbh->do("DELETE FROM backuplist WHERE backup_id = ?", undef, $binfo->{hasbk}); 1867 $sql .= " = ?, backup_id"; 1868 push @vallist, 0; 1869 } 1843 1870 } 1844 1871 } … … 2740 2767 $msg = "Unable to deallocate $disp_alloctypes{$binfo->{type}} $cidr"; 2741 2768 $pinfo = getBlockData($dbh, $binfo->{parent_id}, 'b'); 2742 ##fixme: VRF and rdepth2743 2769 $dbh->do("UPDATE poolips SET custid = ?, available = 'y',". 2744 2770 "city = (SELECT city FROM allocations WHERE id = ?),". 2745 "description = '', notes = '', circuitid = '', vrf = ? WHERE id = ?", undef, 2771 "description = '', notes = '', circuitid = '', vrf = ?, backup_id = 0". 2772 " WHERE id = ?", undef, 2746 2773 ($pinfo->{custid}, $binfo->{parent_id}, $pinfo->{vrf}, $id) ); 2774 $dbh->do("DELETE FROM backuplist WHERE backup_id = ?", undef, $binfo->{hasbk}) 2775 if $binfo->{hasbk}; 2747 2776 $dbh->commit; 2748 2777 }; -
trunk/cgi-bin/main.cgi
r787 r788 1116 1116 ); 1117 1117 1118 # Check to see if user is allowed to do anything with sensitive data 1119 if ($IPDBacl{$authuser} =~ /s/) { 1120 $updargs{privdata} = $webvar{privdata}; 1121 for my $bkfield (qw(brand model type src user vpass epass port)) { 1122 $updargs{"bk$bkfield"} = $webvar{"bk$bkfield"}; 1123 } 1124 $updargs{backupfields} = $webvar{backupfields}; 1125 } else { 1126 # If the user doesn't have permissions to monkey with NOC-things, pass 1127 # a flag so we don't treat it as "backup data removed" 1128 $updargs{ignorebk} = 1; 1129 } 1130 1118 1131 # Semioptional values 1119 $updargs{privdata} = $webvar{privdata} if $IPDBacl{$authuser} =~ /s/;1120 1132 $updargs{node} = $webvar{node} if $webvar{node}; 1121 1133 … … 1182 1194 $page->param(desc => $webvar{desc}); 1183 1195 $page->param(notes => $webvar{notes}); 1184 $page->param(privdata => $webvar{privdata}) 1185 if $IPDBacl{$authuser} =~ /s/; 1196 if ($IPDBacl{$authuser} =~ /s/) { 1197 $page->param(nocling => 1); 1198 $page->param(privdata => $webvar{privdata}); 1199 if ($binfo->{hasbk}) { 1200 $page->param(hasbackup => $binfo->{hasbk}); 1201 for my $bkfield (qw(brand model type src user vpass epass port)) { 1202 $page->param("bk$bkfield" => $binfo->{"bk$bkfield"}); 1203 } 1204 } 1205 } 1186 1206 1187 1207 } # update() -
trunk/templates/update.tmpl
r687 r788 61 61 </tr> 62 62 63 <TMPL_IF privdata>63 <TMPL_IF nocling> 64 64 <tr> 65 65 <td valign="top">Restricted data:</td> 66 66 <td><TMPL_VAR NAME=privdata></td> 67 </tr> 68 69 <tr> 70 <td valign="top">Configuration backup:</td> 71 <td> 72 <TMPL_IF hasbackup> 73 Device will be backed up as below 74 <table><tr><td>Brand:</td><td><TMPL_VAR NAME=bkbrand></td></tr> 75 <tr><td>Model:</td><td><TMPL_VAR NAME=bkmodel></td></tr> 76 <tr><td>Access method:</td><td><TMPL_VAR NAME=bktype></td></tr> 77 <tr><td>Connect from:</td><td><TMPL_VAR NAME=bksrc></td></tr> 78 <tr><td>Username:</td><td><TMPL_VAR NAME=bkuser></td></tr> 79 <tr><td>VTY password:</td><td><TMPL_VAR NAME=bkvpass></td></tr> 80 <tr><td>Enable password:</td><td><TMPL_VAR NAME=bkepass></td></tr> 81 <tr><td>Port:</td><td><TMPL_VAR NAME=bkport></td></tr> 82 </table> 83 <TMPL_ELSE> 84 Device/assignment not flagged for backup 85 </TMPL_IF> 86 </td> 87 67 88 </tr> 68 89 </TMPL_IF>
Note:
See TracChangeset
for help on using the changeset viewer.