Changeset 294 for trunk/dns.cgi
- Timestamp:
- 03/29/12 13:22:59 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r293 r294 1016 1016 my ($code,$msg) = changePermissions($dbh, 'group', $webvar{gid}, \%chperms); 1017 1017 if ($code eq 'OK') { 1018 logaction(0, $session->param("username"), $webvar{gid},1019 "Updated default permissions in group $webvar{gid} (".groupName($dbh, $webvar{gid}).")");1020 1018 if ($alterperms) { 1021 1019 changepage(page => "grpman", warnmsg => … … 1023 1021 groupName($dbh, $webvar{gid})." updated with reduced access"); 1024 1022 } else { 1025 changepage(page => "grpman", resultmsg => 1026 "Updated default permissions in group ".groupName($dbh, $webvar{gid})); 1023 changepage(page => "grpman", resultmsg => $msg); 1027 1024 } 1028 1025 } # fallthrough else 1029 logaction(0, $session->param("username"), $webvar{gid}, "Failed to update default permissions in group ".1030 groupName($dbh, $webvar{gid}).": $msg")1031 if $config{log_failures};1032 1026 # no point in doing extra work 1033 1027 fill_permissions($page, \%chperms); … … 1261 1255 $page->param(add => 1) if $webvar{useraction} eq 'add'; 1262 1256 1263 my ($code,$msg); 1257 # can't re-use $code and $msg for update if we want to be able to identify separate failure states 1258 my ($code,$code2,$msg,$msg2) = ('OK','OK','OK','OK'); 1264 1259 1265 1260 my $alterperms = 0; # flag iff we need to force custom permissions due to user's current access limits … … 1315 1310 ($webvar{makeactive} eq 'on' ? 1 : 0), $webvar{accttype}, $permstring, 1316 1311 $webvar{fname}, $webvar{lname}, $webvar{phone}); 1317 logaction(0, $session->param("username"), $curgroup, "Added user $webvar{uname} (uid $msg)")1318 if $code eq 'OK';1319 1312 } else { 1320 1313 changepage(page => "useradmin", errmsg => "You do not have permission to edit users") … … 1324 1317 changepage(page => "useradmin", errmsg => "You do not have permission to edit the requested user"); 1325 1318 } 1326 # User update is icky. I'd really like to do this in one atomic 1327 # operation, but that would duplicate a **lot** of code in DNSDB.pm 1319 # User update is icky. I'd really like to do this in one atomic operation, 1320 # but that gets hairy by either duplicating a **lot** of code in DNSDB.pm 1321 # or self-torture trying to not commit the transaction until we're really done. 1328 1322 # Allowing for changing group, but not coding web support just yet. 1329 1323 ($code,$msg) = updateUser($dbh, $webvar{uid}, $webvar{uname}, $webvar{gid}, $webvar{pass1}, … … 1332 1326 if ($code eq 'OK') { 1333 1327 $newperms{admin} = 1 if $webvar{accttype} eq 'S'; 1334 ($code,$msg) = changePermissions($dbh, 'user', $webvar{uid}, \%newperms, ($permstring eq 'i')); 1335 logaction(0, $session->param("username"), $curgroup, 1336 "Updated uid $webvar{uid}, user $webvar{uname} ($webvar{fname} $webvar{lname})"); 1328 ($code2,$msg2) = changePermissions($dbh, 'user', $webvar{uid}, \%newperms, ($permstring eq 'i')); 1337 1329 } 1338 1330 } 1339 1331 } 1340 1332 1341 if ($code eq 'OK' ) {1342 1333 if ($code eq 'OK' && $code2 eq 'OK') { 1334 my %pageparams = (page => "useradmin"); 1343 1335 if ($alterperms) { 1344 changepage(page => "useradmin", warnmsg =>1345 "You can only grant permissions you hold. $webvar{uname} ".1346 ($webvar{useraction} eq 'add' ? 'added' : 'updated')." with reduced access.");1336 $pageparams{warnmsg} = "You can only grant permissions you hold.\nUser ". 1337 ($webvar{useraction} eq 'add' ? "$webvar{uname} added" : "info updated for $webvar{uname}"). 1338 ".\nPermissions ".($webvar{useraction} eq 'add' ? 'added' : 'updated')." with reduced access."; 1347 1339 } else { 1348 changepage(page => "useradmin", resultmsg => "Successfully ". 1349 ($webvar{useraction} eq 'add' ? 'added' : 'updated')." user $webvar{uname}"); 1340 $pageparams{resultmsg} = "$msg".($webvar{useraction} eq 'add' ? '' : "\n$msg2"); 1350 1341 } 1342 changepage(%pageparams); 1351 1343 1352 1344 # add/update failed: … … 1367 1359 $page->param(pass1 => $webvar{pass1}); 1368 1360 $page->param(pass2 => $webvar{pass2}); 1369 $page->param(errmsg => $msg); 1361 $page->param(errmsg => "User info updated but permissions update failed: $msg2") if $code eq 'OK'; 1362 $page->param(errmsg => $msg) if $code ne 'OK'; 1370 1363 fill_permissions($page, \%newperms); 1371 1364 fill_actypelist($webvar{accttype}); 1372 1365 fill_clonemelist(); 1373 logaction(0, $session->param("username"), $curgroup, "Failed to $webvar{useraction} user ".1374 "$webvar{uname}: $msg")1375 if $config{log_failures};1376 1366 } 1377 1367 … … 1394 1384 fill_actypelist($userinfo->{type}); 1395 1385 # not using this yet, but adding it now means we can *much* more easily do so later. 1396 $page->param(gid => $ webvar{group_id});1386 $page->param(gid => $userinfo->{group_id}); 1397 1387 1398 1388 my %curperms;
Note:
See TracChangeset
for help on using the changeset viewer.