- Timestamp:
- 04/01/11 18:01:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r87 r88 211 211 212 212 $page->param(id => $webvar{id}); 213 213 214 # first pass = confirm y/n (sorta) 214 215 if (!defined($webvar{del})) { 216 215 217 $page->param(del_getconf => 1); 216 218 $page->param(domain => domainName($dbh,$webvar{id})); 217 # print some neato things?218 219 # } else {220 # #whether actually deleting or cancelling we redirect to the domain list, default format221 219 222 220 } elsif ($webvar{del} eq 'ok') { 221 223 222 my $pargroup = parentID($webvar{id}, 'dom', 'group'); 224 223 my $dom = domainName($dbh, $webvar{id}); … … 232 231 changepage(page => "domlist"); 233 232 } 233 234 234 } else { 235 235 # cancelled. whee! … … 245 245 $page->param(curpage => $webvar{page}); 246 246 247 # select count(*) from (default_)?records where (group|domain)_id=? 248 my $sth = $dbh->prepare("SELECT count(*) FROM ". 247 my $sth = $dbh->prepare("SELECT count(*) FROM ". 249 248 ($webvar{defrec} eq 'y' ? 'default_' : '')."records ". 250 249 "WHERE ".($webvar{defrec} eq 'y' ? 'group' : 'domain')."_id=? ". 251 250 "AND NOT type=$reverse_typemap{SOA}"); 252 253 251 $sth->execute($webvar{id}); 252 my ($count) = ($sth->fetchrow_array); 254 253 255 254 # $sortby = 'host'; … … 402 401 } else { 403 402 $page->param(parentid => $webvar{parentid}); 404 # $page->param(id => $webvar{id});405 403 $page->param(dohere => domainName($dbh,$webvar{parentid})); 406 404 } … … 431 429 "Failed deleting record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl} ($msg)"); 432 430 } 433 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, del_failed => 1, errmsg => $msg); 431 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, 432 del_failed => 1, errmsg => $msg); 434 433 $page->param(del_failed => 1); 435 434 $page->param(errmsg => $msg); … … 493 492 # do.. uhh.. stuff.. if we have no webvar{action} 494 493 if ($webvar{action} && $webvar{action} eq 'add') { 495 # not gonna provide the 4th param: template-or-clone flag, just yet496 494 my %newperms; 497 495 foreach (@permtypes) { … … 499 497 $newperms{$_} = 1 if $webvar{$_} eq 'on'; 500 498 } 499 # not gonna provide the 4th param: template-or-clone flag, just yet 501 500 my ($code,$msg) = addGroup($dbh, $webvar{newgroup}, $webvar{pargroup}, \%newperms); 502 501 if ($code eq 'OK') { … … 511 510 fill_grouplist('pargroup',$webvar{pargroup}); 512 511 } else { 513 # $page->param514 512 fill_grouplist('pargroup',$curgroup); 515 # fill default permissions with immediate parent's current ones513 # fill default permissions with immediate parent's current ones 516 514 my %parperms; 517 515 getPermissions($dbh, 'group', $curgroup, \%parperms); … … 540 538 $page->param(curpage => $webvar{page}); 541 539 listgroups(); 540 ##fixme: log 542 541 } else { 543 542 ##fixme: need to clean up log when deleting a major container … … 603 602 604 603 $page->param(is_admin => $permissions{admin}); 604 605 $webvar{action} = '' if !$webvar{action}; 605 606 606 607 if ($webvar{action} eq 'add' or $webvar{action} eq 'update') { … … 676 677 if ($code eq 'OK') { 677 678 679 ##fixme: log doesn't log. WTF? O_o 678 680 logaction(0, $session->param("username"), $webvar{group}, 679 ($webvar{action} eq 'add' ? 'Added' : 'Updated')." u ser $webvar{uname} ($webvar{fname} $webvar{lname})");681 ($webvar{action} eq 'add' ? 'Added' : 'Updated')." uid $webvar{uid}, user $webvar{uname} ($webvar{fname} $webvar{lname})"); 680 682 if ($alterperms) { 681 683 changepage(page => "useradmin", warnmsg => … … 707 709 fill_actypelist($webvar{accttype}); 708 710 fill_clonemelist(); 711 ##fixme: log 709 712 } 710 713 … … 760 763 $page->param(grpperms => $grppermlist->output); 761 764 762 } elsif ($webvar{page} eq 'adduser') {763 764 my ($code,$msg);765 766 if ($webvar{pass1} ne $webvar{pass2}) {767 $code = 'FAIL';768 $msg = "Passwords don't match";769 } else {770 # assemble a permission string - far simpler than trying to pass an771 # indeterminate set of permission flags individually772 my $permstring;773 if ($webvar{perms_type} eq 'custom') {774 $permstring = 'C:,g:,u:,d:,r:';775 $page->param(perm_custom => 1);776 } elsif ($webvar{perms_type} eq 'clone') {777 $permstring = 'c:';778 $page->param(perm_clone => 1);779 } else {780 $permstring = 'i';781 # $page->param(perm_inherit => 1);782 }783 ($code,$msg) = addUser($dbh,$webvar{uname}, $webvar{group}, $webvar{pass1},784 ($webvar{makeactive} eq 'on' ? 1 : 0), $webvar{accttype},785 $webvar{fname}, $webvar{lname}, $webvar{phone});786 }787 788 # hokay, a bit of magic to decide which page we hit.789 if ($code eq 'OK') {790 ## log791 logaction(0, $session->param("username"), $webvar{group},792 "Added user $webvar{uname} ($webvar{fname} $webvar{lname})");793 changepage(page => "useradmin");794 } else {795 # oddity - apparently, xhtml 1.0 strict swallows username as an HTML::Template var. O_o796 $page->param(add_failed => 1);797 $page->param(uname => $webvar{uname});798 $page->param(fname => $webvar{fname});799 $page->param(lname => $webvar{lname});800 $page->param(pass1 => $webvar{pass1});801 $page->param(pass2 => $webvar{pass2});802 $page->param(errmsg => $msg);803 fill_actypelist($webvar{accttype});804 fill_clonemelist();805 }806 807 # $page->param(add_failed => 1);808 809 } elsif ($webvar{page} eq 'deluser') {810 811 $page->param(id => $webvar{id});812 # first pass = confirm y/n (sorta)813 if (!defined($webvar{del})) {814 $page->param(del_getconf => 1);815 $page->param(user => userFullName($dbh,$webvar{id}));816 } elsif ($webvar{del} eq 'ok') {817 ## fixme: find group id user is in (for logging) *before* we delete the user818 my ($code,$msg) = delUser($dbh, $webvar{id});819 if ($code ne 'OK') {820 # need to find failure mode821 $page->param(del_failed => 1);822 $page->param(errmsg => $msg);823 list_users($curgroup);824 } else {825 # success. go back to the user list, do not pass "GO"826 ## log827 logaction(0, $session->param("username"), $webvar{group}, "Added domain $webvar{domain}");828 changepage(page => "useradmin");829 }830 } else {831 # cancelled. whee!832 changepage(page => "useradmin");833 }834 835 } elsif ($webvar{page} eq 'edituser') {765 #} elsif ($webvar{page} eq 'adduser') { 766 # 767 # my ($code,$msg); 768 # 769 # if ($webvar{pass1} ne $webvar{pass2}) { 770 # $code = 'FAIL'; 771 # $msg = "Passwords don't match"; 772 # } else { 773 ## assemble a permission string - far simpler than trying to pass an 774 ## indeterminate set of permission flags individually 775 #my $permstring; 776 #if ($webvar{perms_type} eq 'custom') { 777 # $permstring = 'C:,g:,u:,d:,r:'; 778 # $page->param(perm_custom => 1); 779 #} elsif ($webvar{perms_type} eq 'clone') { 780 # $permstring = 'c:'; 781 # $page->param(perm_clone => 1); 782 #} else { 783 # $permstring = 'i'; 784 ## $page->param(perm_inherit => 1); 785 #} 786 # ($code,$msg) = addUser($dbh,$webvar{uname}, $webvar{group}, $webvar{pass1}, 787 # ($webvar{makeactive} eq 'on' ? 1 : 0), $webvar{accttype}, 788 # $webvar{fname}, $webvar{lname}, $webvar{phone}); 789 # } 790 # 791 ## hokay, a bit of magic to decide which page we hit. 792 # if ($code eq 'OK') { 793 ###log 794 # logaction(0, $session->param("username"), $webvar{group}, 795 # "Added user $webvar{uname} ($webvar{fname} $webvar{lname})"); 796 # changepage(page => "useradmin"); 797 # } else { 798 ## oddity - apparently, xhtml 1.0 strict swallows username as an HTML::Template var. O_o 799 # $page->param(add_failed => 1); 800 # $page->param(uname => $webvar{uname}); 801 # $page->param(fname => $webvar{fname}); 802 # $page->param(lname => $webvar{lname}); 803 # $page->param(pass1 => $webvar{pass1}); 804 # $page->param(pass2 => $webvar{pass2}); 805 # $page->param(errmsg => $msg); 806 # fill_actypelist($webvar{accttype}); 807 # fill_clonemelist(); 808 # } 809 # 810 ## $page->param(add_failed => 1); 811 # 812 #} elsif ($webvar{page} eq 'deluser') { 813 # 814 # $page->param(id => $webvar{id}); 815 # # first pass = confirm y/n (sorta) 816 # if (!defined($webvar{del})) { 817 # $page->param(del_getconf => 1); 818 # $page->param(user => userFullName($dbh,$webvar{id})); 819 # } elsif ($webvar{del} eq 'ok') { 820 ###fixme: find group id user is in (for logging) *before* we delete the user 821 # my ($code,$msg) = delUser($dbh, $webvar{id}); 822 # if ($code ne 'OK') { 823 ## need to find failure mode 824 # $page->param(del_failed => 1); 825 # $page->param(errmsg => $msg); 826 # list_users($curgroup); 827 # } else { 828 # # success. go back to the user list, do not pass "GO" 829 ###log 830 # logaction(0, $session->param("username"), $webvar{group}, "Added domain $webvar{domain}"); 831 # changepage(page => "useradmin"); 832 # } 833 # } else { 834 # # cancelled. whee! 835 # changepage(page => "useradmin"); 836 # } 837 # 838 #} elsif ($webvar{page} eq 'edituser') { 836 839 837 840 } elsif ($webvar{page} eq 'dnsq') { … … 925 928 my ($code,$msg) = importAXFR($dbh, $webvar{ifrom}, $domain, $webvar{group}, 926 929 $webvar{domstatus}, $webvar{rwsoa}, $webvar{rwns}); 930 ##fixme: log 927 931 $row{domok} = $msg if $code eq 'OK'; 928 932 if ($code eq 'WARN') {
Note:
See TracChangeset
for help on using the changeset viewer.