Changeset 411 for trunk


Ignore:
Timestamp:
10/05/12 14:04:00 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Check and munge state in DNSDB::updateUser(), same as addUser().
Clean up copy-paste job for dns-rpc.cgi updateUser and make sure it
works. See #43.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r410 r411  
    28232823
    28242824  my $resultmsg = '';
     2825
     2826  # Munge in some alternate state values
     2827  $state = 1 if $state =~ /^active$/;
     2828  $state = 1 if $state =~ /^on$/;
     2829  $state = 0 if $state =~ /^inactive$/;
     2830  $state = 0 if $state =~ /^off$/;
    28252831
    28262832  # Allow transactions, and raise an exception on errors so we can catch it later.
  • trunk/dns-rpc.cgi

    r409 r411  
    244244  die "Missing UID\n" if !$args{uid};
    245245
    246 # not sure how to usefully represent permissions from any further out from DNSDB.pm :/
    247 # not to mention, permissions are checked at the UI layer, not the DB layer.
    248   my $perms = {domain_edit => 1, domain_create => 1, domain_delete => 1,
    249         record_edit => 1, record_create => 1, record_delete => 1
    250         };
    251246  # bend and twist;  get those arguments in in the right order!
     247  $args{type} = 'u' if !$args{type};
    252248  my @userargs = ($args{uid}, $args{username}, $args{group}, $args{pass}, $args{state}, $args{type});
    253249  for my $argname ('fname','lname','phone') {
     
    257253##fixme:  also underlying in DNSDB::updateUser():  no way to just update this or that attribute;
    258254#         have to pass them all in to be overwritten
    259   my ($code,$msg) = DNSDB::addUser($dbh, @userargs);
     255  my ($code,$msg) = DNSDB::updateUser($dbh, @userargs);
    260256  die $msg if $code eq 'FAIL';
    261257}
Note: See TracChangeset for help on using the changeset viewer.