Changeset 406 for trunk


Ignore:
Timestamp:
10/05/12 12:44:13 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix the fix for the fixed initRPC(). Usernames should be stored
with the RPC system string to make sure they don't collide with
"normal" users. Also check the right variable to see if we retrieved
an existing user record or not. See #33.
Fix groupID() to actually work; apparently it's not used in the
main UI or this would have been fixed a long time ago.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r404 r406  
    14191419  return if !$args{fullname};
    14201420
    1421   my $tmpuser = $dbh->selectrow_hashref("SELECT user_id AS userid,group_id,firstname,lastname,status".
     1421  $args{username} = "$args{username}/$args{rpcsys}";
     1422
     1423  my $tmpuser = $dbh->selectrow_hashref("SELECT username,user_id AS userid,group_id,firstname,lastname,status".
    14221424        " FROM users WHERE username=?", undef, ($args{username}) );
    1423   if (!%userdata) {
     1425  if (!$tmpuser) {
    14241426    $dbh->do("INSERT INTO users (username,password,firstname,type) VALUES (?,'RPC',?,'R')", undef,
    14251427        ($args{username}, $args{fullname}) );
    1426     $tmpuser = $dbh->selectrow_hashref("SELECT user_id AS userid,group_id,firstname,lastname,status".
     1428    $tmpuser = $dbh->selectrow_hashref("SELECT username,user_id AS userid,group_id,firstname,lastname,status".
    14271429        " FROM users WHERE username=?", undef, ($args{username}) );
    14281430  }
    14291431  %userdata = %{$tmpuser};
    14301432  $userdata{fullname} = "$userdata{firstname} $userdata{lastname} ($args{rpcsys})";
    1431   $userdata{username} = "$args{username}/$args{rpcsys}";
    1432   return 1 if %userdata;
     1433  return 1 if $tmpuser;
    14331434} # end initRPC()
    14341435
     
    25572558  my $dbh = shift;
    25582559  my $group = shift;
    2559   my ($grpid) = $dbh->selectrow_array("SELECT group_id FROM groups WHERE group=?", undef, ($group) );
     2560  my ($grpid) = $dbh->selectrow_array("SELECT group_id FROM groups WHERE group_name=?", undef, ($group) );
    25602561  $errstr = $DBI::errstr if !$grpid;
    25612562  return $grpid if $grpid;
Note: See TracChangeset for help on using the changeset viewer.