Changeset 95 for trunk/dns.cgi
- Timestamp:
- 04/15/11 17:53:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r93 r95 22 22 use Data::Dumper; 23 23 24 #sub is_tainted { 25 # # from perldoc perlsec 26 # return ! eval { eval("#" . substr(join("", @_), 0, 0)); 1 }; 27 #} 28 #use Cwd 'abs_path'; 29 #use File::Basename; 30 #use lib dirname( abs_path $0 ); 31 #die "argh! tainted!" if is_tainted($0); 32 #die "argh! \@INC got tainted!" if is_tainted(@INC); 33 34 # custom modules 24 35 use lib '.'; 25 # custom modules26 36 use DNSDB qw(:ALL); 27 37 … … 185 195 186 196 $page->param(curpage => $webvar{page}); 187 if ($webvar{del_failed}) { 188 $page->param(del_failed => 1); 189 $page->param(errmsg => $webvar{errmsg}); 190 } 197 $page->param(errmsg => $webvar{errmsg}) if $webvar{errmsg}; 198 # if ($webvar{del_failed}) { 199 # $page->param(del_failed => 1); 200 # $page->param(errmsg => $webvar{errmsg}); 201 # } 191 202 192 203 listdomains(); 193 204 194 205 } elsif ($webvar{page} eq 'newdomain') { 206 207 changepage(page => "domlist", errmsg => "You are not permitted to add domains") 208 unless ($permissions{admin} || $permissions{domain_create}); 195 209 196 210 # hmm. nothing to do here? … … 204 218 } elsif ($webvar{page} eq 'adddomain') { 205 219 220 changepage(page => "domlist", errmsg => "You are not permitted to add domains") 221 unless ($permissions{admin} || $permissions{domain_create}); 222 206 223 my ($code,$msg) = addDomain($dbh,$webvar{domain},$webvar{group},($webvar{makeactive} eq 'on' ? 1 : 0)); 207 224 … … 216 233 } elsif ($webvar{page} eq 'deldom') { 217 234 235 changepage(page => "domlist", errmsg => "You are not permitted to delete domains") 236 unless ($permissions{admin} || $permissions{domain_delete}); 237 218 238 $page->param(id => $webvar{id}); 219 239 … … 232 252 # need to find failure mode 233 253 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom ($msg)"); 234 changepage(page => "domlist", del_failed => 1, errmsg => $msg);254 changepage(page => "domlist", errmsg => "Error deleting domain $dom: $msg"); 235 255 } else { 236 256 logaction($webvar{id}, $session->param("username"), $pargroup, "Deleted domain $dom"); … … 244 264 245 265 } elsif ($webvar{page} eq 'reclist') { 266 267 ##fixme: ACL needs pondering. Does "edit domain" interact with record add/remove/etc? 268 # Note this seems to be answered "no" in Vega. 269 # ACLs 270 $page->param(record_create => ($permissions{admin} || $permissions{record_create}) ); 271 # $page->param(record_edit => ($permissions{admin} || $permissions{record_edit}) ); 272 $page->param(record_delete => ($permissions{admin} || $permissions{record_delete}) ); 246 273 247 274 # Handle record list for both default records (per-group) and live domain records … … 280 307 } 281 308 282 if ($webvar{del_failed}) { 283 $page->param(del_failed => 1); 284 $page->param(errmsg => $webvar{errmsg}); 285 } 309 $page->param(errmsg => $webvar{errmsg}) if $webvar{errmsg}; 286 310 287 311 } elsif ($webvar{page} eq 'record') { 288 312 289 313 if ($webvar{recact} eq 'new') { 314 315 changepage(page => "reclist", errmsg => "You are not permitted to add records", id => $webvar{parentid}) 316 unless ($permissions{admin} || $permissions{record_create}); 290 317 291 318 $page->param(todo => "Add record"); … … 297 324 298 325 } elsif ($webvar{recact} eq 'add') { 326 327 changepage(page => "reclist", errmsg => "You are not permitted to add records", id => $webvar{parentid}) 328 unless ($permissions{admin} || $permissions{record_create}); 299 329 300 330 my @recargs = ($dbh,$webvar{defrec},$webvar{parentid},$webvar{name},$webvar{type},$webvar{address},$webvar{ttl}); … … 339 369 } elsif ($webvar{recact} eq 'edit') { 340 370 371 changepage(page => "reclist", errmsg => "You are not permitted to edit records", id => $webvar{parentid}) 372 unless ($permissions{admin} || $permissions{record_edit}); 373 341 374 $page->param(todo => "Update record"); 342 375 $page->param(recact => "update"); … … 354 387 355 388 } elsif ($webvar{recact} eq 'update') { 389 390 changepage(page => "reclist", errmsg => "You are not permitted to edit records", id => $webvar{parentid}) 391 unless ($permissions{admin} || $permissions{record_edit}); 356 392 357 393 my ($code,$msg) = updateRec($dbh,$webvar{defrec},$webvar{id}, … … 402 438 403 439 } elsif ($webvar{page} eq 'delrec') { 440 441 changepage(page => "reclist", errmsg => "You are not permitted to delete records", id => $webvar{parentid}) 442 unless ($permissions{admin} || $permissions{record_delete}); 404 443 405 444 $page->param(id => $webvar{id}); … … 427 466 } 428 467 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, 429 del_failed => 1, errmsg => $msg);430 $page->param(del_failed => 1);431 $page->param(errmsg => $msg);432 showdomain($webvar{defrec}, $webvar{parentid});468 errmsg => "Error deleting record: $msg"); 469 # $page->param(del_failed => 1); 470 # $page->param(errmsg => $msg); 471 # showdomain($webvar{defrec}, $webvar{parentid}); 433 472 } else { 434 473 if ($webvar{defrec} eq 'y') { … … 1195 1234 $rec->{port} = 'n/a' unless ($rec->{type} eq 'SRV'); 1196 1235 $row++; 1236 # ACLs 1237 $rec->{record_edit} = ($permissions{admin} || $permissions{record_edit}); 1238 $rec->{record_delete} = ($permissions{admin} || $permissions{record_delete}); 1197 1239 } 1198 1240 $page->param(reclist => $foo2); … … 1319 1361 $filter = $session->param($webvar{page}.'filter'); 1320 1362 $searchsubs = $session->param($webvar{page}.'searchsubs'); 1363 1364 # ACLs 1365 $page->param(domain_create => ($permissions{admin} || $permissions{domain_create}) ); 1366 $page->param(domain_edit => ($permissions{admin} || $permissions{domain_edit}) ); 1367 $page->param(domain_delete => ($permissions{admin} || $permissions{domain_delete}) ); 1321 1368 1322 1369 ##fixme: $logingroup or $curgroup? … … 1387 1434 $row{sid} = $sid; 1388 1435 $row{offset} = $offset; 1436 # ACLs 1437 $row{domain_edit} = ($permissions{admin} || $permissions{domain_edit}); 1438 $row{domain_delete} = ($permissions{admin} || $permissions{domain_delete}); 1389 1439 ##fixme: need to clean up status indicator/usage/inversion 1390 1440 push @domlist, \%row;
Note:
See TracChangeset
for help on using the changeset viewer.