Changeset 187
- Timestamp:
- 12/06/11 15:58:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r185 r187 373 373 my $dom = domainName($dbh, $webvar{id}); 374 374 my ($code,$msg) = delDomain($dbh, $webvar{id}); 375 if ($code ne 'OK') { 375 if ($code eq 'OK') { 376 logaction($webvar{id}, $session->param("username"), $pargroup, "Deleted domain $dom"); 377 changepage(page => "domlist", resultmsg => "Deleted domain $dom"); 378 } else { 376 379 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom ($msg)"); 377 380 changepage(page => "domlist", errmsg => "Error deleting domain $dom: $msg"); 378 } else {379 logaction($webvar{id}, $session->param("username"), $pargroup, "Deleted domain $dom");380 changepage(page => "domlist", resultmsg => "Deleted domain $dom");381 381 } 382 382 … … 643 643 my $rec = getRecLine($dbh,$webvar{defrec},$webvar{id}); 644 644 my ($code,$msg) = delRec($dbh,$webvar{defrec},$webvar{id}); 645 if ($code ne 'OK') { 645 if ($code eq 'OK') { 646 if ($webvar{defrec} eq 'y') { 647 ##fixme: log distance for MX; log port/weight/distance for SRV 648 my $restr = "Deleted default record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}"; 649 logaction(0, $session->param("username"), $rec->{parid}, $restr); 650 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, resultmsg => $restr); 651 } else { 652 my $restr = "Deleted record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}"; 653 logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'), $restr); 654 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, resultmsg => $restr); 655 } 656 } else { 646 657 ## need to find failure mode 647 658 if ($webvar{defrec} eq 'y') { … … 655 666 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, 656 667 errmsg => "Error deleting record: $msg"); 657 # $page->param(del_failed => 1);658 # $page->param(errmsg => $msg);659 # showdomain($webvar{defrec}, $webvar{parentid});660 } else {661 if ($webvar{defrec} eq 'y') {662 my $restr = "Deleted default record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}";663 logaction(0, $session->param("username"), $rec->{parid}, $restr);664 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, resultmsg => $restr);665 } else {666 my $restr = "Deleted record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}";667 logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'), $restr);668 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, resultmsg => $restr);669 }670 668 } 671 669 } else { … … 808 806 changepage(page => "grpman", resultmsg => "Added group $webvar{newgroup}"); 809 807 } 810 } 808 } # fallthrough else 809 logaction(0, $session->param("username"), $webvar{pargroup}, "Failed to add group $webvar{newgroup}: $msg"); 811 810 # no point in doing extra work 812 811 fill_permissions($page, \%newperms); … … 842 841 # up along with an unchecked-by-default check box to YES DAMMIT DELETE THE WHOLE THING 843 842 844 # $page->param(groupname => groupName($dbh,$webvar{id}));845 # print some neato things?846 847 # } else {848 # #whether actually deleting or cancelling we redirect to the group list, default format849 850 843 } elsif ($webvar{del} eq 'ok') { 851 844 my $deleteme = groupName($dbh,$webvar{id}); # get this before we delete it... 852 845 my $delparent = parentID($webvar{id}, 'group','group'); 853 846 my ($code,$msg) = delGroup($dbh, $webvar{id}); 854 if ($code ne 'OK') { 855 # need to find failure mode 856 logaction(0, $session->param("username"), $delparent, "Failure deleting group $deleteme: $msg"); 857 changepage(page => "grpman", errmsg => "Error deleting group $deleteme: $msg"); 858 } else { 847 if ($code eq 'OK') { 859 848 ##fixme: need to clean up log when deleting a major container 860 849 logaction(0, $session->param("username"), $delparent, "Deleted group $deleteme"); 861 850 changepage(page => "grpman", resultmsg => "Deleted group $deleteme"); 851 } else { 852 # need to find failure mode 853 logaction(0, $session->param("username"), $delparent, "Failed to delete group $deleteme: $msg"); 854 changepage(page => "grpman", errmsg => "Error deleting group $deleteme: $msg"); 862 855 } 863 856 } else { … … 905 898 "Updated default permissions in group ".groupName($dbh, $webvar{gid})); 906 899 } 907 } 900 } # fallthrough else 901 logaction(0, $session->param("username"), $webvar{gid}, "Failed to update default permissions in group ". 902 groupName($dbh, $webvar{gid}).": $msg"); 908 903 # no point in doing extra work 909 904 fill_permissions($page, \%chperms); … … 994 989 } else { 995 990 logaction($webvar{$_}, $session->param("username"), parentID($webvar{$_}, 'dom', 'group'), 996 "Fail ure movingdomain ".domainName($dbh, $webvar{$_})." to group $newgname: $msg");991 "Failed to move domain ".domainName($dbh, $webvar{$_})." to group $newgname: $msg"); 997 992 } 998 993 $row{domerr} = $msg; … … 1051 1046 $row{domok} = ($code eq 'OK'); 1052 1047 } else { 1053 logaction($webvar{$_}, $session->param("username"), $pargroup, "Fail ure deletingdomain $dom: $msg");1048 logaction($webvar{$_}, $session->param("username"), $pargroup, "Failed to delete domain $dom: $msg"); 1054 1049 } 1055 1050 $row{domerr} = $msg; … … 1200 1195 $newperms{admin} = 1 if $webvar{accttype} eq 'S'; 1201 1196 ($code,$msg) = changePermissions($dbh, 'user', $webvar{uid}, \%newperms, ($permstring eq 'i')); 1197 logaction(0, $session->param("username"), $curgroup, 1198 "Updated uid $webvar{uid}, user $webvar{uname} ($webvar{fname} $webvar{lname})"); 1202 1199 } 1203 logaction(0, $session->param("username"), $curgroup,1204 "Updated uid $webvar{uid}, user $webvar{uname} ($webvar{fname} $webvar{lname})");1205 1200 } 1206 1201 } … … 1238 1233 fill_actypelist($webvar{accttype}); 1239 1234 fill_clonemelist(); 1240 ##fixme: log 1235 logaction(0, $session->param("username"), $curgroup, "Failed to $webvar{action} user ". 1236 "$webvar{uname}: $msg"); 1241 1237 } 1242 1238 … … 1304 1300 my $userref = getUserData($dbh, $webvar{id}); 1305 1301 my ($code,$msg) = delUser($dbh, $webvar{id}); 1306 if ($code ne 'OK') { 1307 # need to find failure mode 1308 $page->param(del_failed => 1); 1309 $page->param(errmsg => $msg); 1310 list_users($curgroup); 1311 #Error deleting user <TMPL_VAR NAME=delusername>: <TMPL_VAR NAME=errmsg> 1312 } else { 1302 if ($code eq 'OK') { 1313 1303 # success. go back to the user list, do not pass "GO" 1314 1304 # actions on users have a domain id of 0, always … … 1317 1307 changepage(page => "useradmin", resultmsg => "Deleted user ".$userref->{username}. 1318 1308 " (".$userref->{lastname}.", ".$userref->{firstname}.")"); 1309 } else { 1310 # need to find failure mode 1311 $page->param(del_failed => 1); 1312 $page->param(errmsg => $msg); 1313 list_users($curgroup); 1314 logaction(0, $session->param("username"), $curgroup, "Failed to delete user ". 1315 "$webvar{id}/".$userref->{username}.": $msg"); 1319 1316 } 1320 1317 } else {
Note:
See TracChangeset
for help on using the changeset viewer.