Changeset 479
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r478 r479 2668 2668 sub addUser { 2669 2669 $errstr = ''; 2670 my $dbh = shift; 2670 my $self = shift; 2671 my $dbh = $self->{dbh}; 2671 2672 my $username = shift; 2672 2673 my $group = shift; … … 2782 2783 # - a "Starts with" string 2783 2784 sub getUserCount { 2784 my $dbh = shift; 2785 my $self = shift; 2786 my $dbh = $self->{dbh}; 2785 2787 2786 2788 my %args = @_; … … 2810 2812 # - offset/return-all-everything flag (defaults to $perpage records) 2811 2813 sub getUserList { 2812 my $dbh = shift; 2814 my $self = shift; 2815 my $dbh = $self->{dbh}; 2813 2816 2814 2817 my %args = @_; … … 2850 2853 # Returns a reference to a list of hashrefs suitable to feeding to HTML::Template 2851 2854 sub getUserDropdown { 2852 my $dbh = shift; 2855 my $self = shift; 2856 my $dbh = $self->{dbh}; 2853 2857 my $grp = shift; 2854 2858 my $sel = shift || 0; … … 2873 2877 # Update general data about user 2874 2878 sub updateUser { 2875 my $dbh = shift; 2879 my $self = shift; 2880 my $dbh = $self->{dbh}; 2876 2881 2877 2882 ##fixme: tweak calling convention so that we can update any given bit of data … … 2935 2940 # Returns a success/failure code and matching message 2936 2941 sub delUser { 2937 my $dbh = shift; 2942 my $self = shift; 2943 my $dbh = $self->{dbh}; 2938 2944 my $userid = shift; 2939 2945 2940 2946 return ('FAIL',"Bad userid") if !defined($userid); 2941 2947 2942 my $userdata = getUserData($dbh,$userid);2948 my $userdata = $self->getUserData($userid); 2943 2949 2944 2950 # Allow transactions, and raise an exception on errors so we can catch it later. … … 3001 3007 # Returns undef on errors. 3002 3008 sub userStatus { 3003 my $dbh = shift; 3009 my $self = shift; 3010 my $dbh = $self->{dbh}; 3004 3011 my $id = shift; 3005 3012 my $newstatus = shift || 'mu'; … … 3007 3014 return undef if $id !~ /^\d+$/; 3008 3015 3009 my $userdata = getUserData($dbh,$id);3016 my $userdata = $self->getUserData($id); 3010 3017 3011 3018 # Allow transactions, and raise an exception on errors so we can catch it later. … … 3049 3056 # Get misc user data for display 3050 3057 sub getUserData { 3051 my $dbh = shift; 3058 my $self = shift; 3059 my $dbh = $self->{dbh}; 3052 3060 my $uid = shift; 3053 3061 -
trunk/dns-rpc.cgi
r477 r479 245 245 push @userargs, $args{$argname}; 246 246 } 247 my ($code,$msg) = DNSDB::addUser($dbh,@userargs);247 my ($code,$msg) = $dnsdb->addUser(@userargs); 248 248 die $msg if $code eq 'FAIL'; 249 249 return $msg; … … 271 271 ##fixme: also underlying in DNSDB::updateUser(): no way to just update this or that attribute; 272 272 # have to pass them all in to be overwritten 273 my ($code,$msg) = DNSDB::updateUser($dbh,@userargs);273 my ($code,$msg) = $dnsdb->updateUser(@userargs); 274 274 die $msg if $code eq 'FAIL'; 275 275 return $msg; … … 282 282 283 283 die "Missing UID\n" if !$args{uid}; 284 my ($code,$msg) = DNSDB::delUser($dbh,$args{uid});284 my ($code,$msg) = $dnsdb->delUser($args{uid}); 285 285 die $msg if $code eq 'FAIL'; 286 286 return $msg; -
trunk/dns.cgi
r477 r479 1096 1096 if ($flag && ($permissions{admin} || $permissions{user_edit} || 1097 1097 ($permissions{self_edit} && $webvar{id} == $session->param('uid')) )) { 1098 my $stat = userStatus($dbh,$webvar{id},$webvar{userstatus});1098 my $stat = $dnsdb->userStatus($webvar{id}, $webvar{userstatus}); 1099 1099 $page->param(resultmsg => $DNSDB::resultstr); 1100 1100 } else { … … 1199 1199 unless $permissions{admin} || $permissions{user_create}; 1200 1200 # no scope check; user is created in the current group 1201 ($code,$msg) = addUser($dbh,$webvar{uname}, $curgroup, $webvar{pass1},1201 ($code,$msg) = $dnsdb->addUser($webvar{uname}, $curgroup, $webvar{pass1}, 1202 1202 ($webvar{makeactive} eq 'on' ? 1 : 0), $webvar{accttype}, $permstring, 1203 1203 $webvar{fname}, $webvar{lname}, $webvar{phone}); … … 1214 1214 # or self-torture trying to not commit the transaction until we're really done. 1215 1215 # Allowing for changing group, but not coding web support just yet. 1216 ($code,$msg) = updateUser($dbh,$webvar{uid}, $webvar{uname}, $webvar{gid}, $webvar{pass1},1216 ($code,$msg) = $dnsdb->updateUser($webvar{uid}, $webvar{uname}, $webvar{gid}, $webvar{pass1}, 1217 1217 ($webvar{makeactive} eq 'on' ? 1 : 0), $webvar{accttype}, 1218 1218 $webvar{fname}, $webvar{lname}, $webvar{phone}); … … 1275 1275 fill_clonemelist(); 1276 1276 1277 my $userinfo = getUserData($dbh,$webvar{user});1277 my $userinfo = $dnsdb->getUserData($webvar{user}); 1278 1278 fill_actypelist($userinfo->{type}); 1279 1279 # not using this yet, but adding it now means we can *much* more easily do so later. … … 1319 1319 $page->param(user => $dnsdb->userFullName($webvar{id})); 1320 1320 } elsif ($webvar{del} eq 'ok') { 1321 my ($code,$msg) = delUser($dbh,$webvar{id});1321 my ($code,$msg) = $dnsdb->delUser($webvar{id}); 1322 1322 if ($code eq 'OK') { 1323 1323 # success. go back to the user list, do not pass "GO" … … 1965 1965 local $webvar{clonesrc} = 0 if !defined($webvar{clonesrc}); 1966 1966 1967 my $clones = getUserDropdown($dbh,$curgroup, $webvar{clonesrc});1967 my $clones = $dnsdb->getUserDropdown($curgroup, $webvar{clonesrc}); 1968 1968 $page->param(clonesrc => $clones); 1969 1969 } … … 2190 2190 my $childlist = join(',',@childgroups); 2191 2191 2192 my $count = getUserCount($dbh,(childlist => $childlist, curgroup => $curgroup,2193 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ) );2192 my $count = $dnsdb->getUserCount(childlist => $childlist, curgroup => $curgroup, 2193 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ); 2194 2194 2195 2195 # fill page count and first-previous-next-last-all bits … … 2216 2216 $page->param(searchsubs => $searchsubs) if $searchsubs; 2217 2217 2218 my $ulist = getUserList($dbh,(childlist => $childlist, curgroup => $curgroup,2218 my $ulist = $dnsdb->getUserList(childlist => $childlist, curgroup => $curgroup, 2219 2219 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef), 2220 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder) );2220 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder); 2221 2221 # Some UI things need to be done to the list (unlike other lists) 2222 2222 foreach my $u (@{$ulist}) {
Note:
See TracChangeset
for help on using the changeset viewer.