Changeset 112 for trunk/DNSDB.pm
- Timestamp:
- 08/02/11 18:54:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r111 r112 27 27 &initGlobals 28 28 &initPermissions &getPermissions &changePermissions &comparePermissions 29 &changeGroup 29 30 &connectDB &finish 30 31 &addDomain &delDomain &domainName &domainID … … 43 44 &initGlobals 44 45 &initPermissions &getPermissions &changePermissions &comparePermissions 46 &changeGroup 45 47 &connectDB &finish 46 48 &addDomain &delDomain &domainName &domainID … … 348 350 return $retval; 349 351 } # end comparePermissions() 352 353 354 ## DNSDB::changeGroup() 355 # Change group ID of an entity 356 # Takes a database handle, entity type, entity ID, and new group ID 357 sub changeGroup { 358 my $dbh = shift; 359 my $type = shift; 360 my $id = shift; 361 my $newgrp = shift; 362 363 ##fixme: fail on not enough args 364 #return ('FAIL', "Missing 365 366 if ($type eq 'domain') { 367 $dbh->do("UPDATE domains SET group_id=? WHERE domain_id=?", undef, ($newgrp, $id)) 368 or return ('FAIL','Group change failed: '.$dbh->errstr); 369 } elsif ($type eq 'user') { 370 $dbh->do("UPDATE users SET group_id=? WHERE user_id=?", undef, ($newgrp, $id)) 371 or return ('FAIL','Group change failed: '.$dbh->errstr); 372 } elsif ($type eq 'group') { 373 $dbh->do("UPDATE groups SET parent_group_id=? WHERE group_id=?", undef, ($newgrp, $id)) 374 or return ('FAIL','Group change failed: '.$dbh->errstr); 375 } 376 return ('OK','OK'); 377 } # end changeGroup() 350 378 351 379
Note:
See TracChangeset
for help on using the changeset viewer.