From: <jam...@te...> - 2002-09-09 19:47:21
|
This patch allows one to allow editing of hosts names but not allow adding or vice versa/ This patch works the same thing the one I just sent for the interfaces. Cheers...james diff -ur .delta/net/acl_security.pl current/net/acl_security.pl --- .delta/net/acl_security.pl Mon Sep 9 14:20:51 2002 +++ current/net/acl_security.pl Mon Sep 9 15:31:46 2002 @@ -43,7 +43,11 @@ printf "<input type=radio name=hosts value=0 %s> $text{'no'}</td>\n", $_[0]->{'hosts'} ? "" : "checked"; -print "<td> </td><td> </td></tr>\n"; +print "<td><b>$text{'acl_hosts_add'}</b></td> <td nowrap>\n"; +printf "<input type=radio name=hosts_add value=1 %s> $text{'yes'}\n", + $_[0]->{'hosts_add'} == 1 ? "checked" : ""; +printf "<input type=radio name=hosts_add value=0 %s> $text{'no'}</td> </tr>\n", + $_[0]->{'hosts_add'} ? "" : "checked"; } # acl_security_save(&options) @@ -55,5 +59,6 @@ $_[0]->{'routes'} = $in{'routes'}; $_[0]->{'dns'} = $in{'dns'}; $_[0]->{'hosts'} = $in{'hosts'}; +$_[0]->{'hosts_add'} = $in{'hosts_add'}; } diff -ur .delta/net/defaultacl current/net/defaultacl --- .delta/net/defaultacl Mon Sep 9 14:20:51 2002 +++ current/net/defaultacl Mon Sep 9 15:05:34 2002 @@ -3,3 +3,4 @@ routes=2 dns=2 hosts=2 +hosts_add=1 diff -ur .delta/net/edit_host.cgi current/net/edit_host.cgi --- .delta/net/edit_host.cgi Mon Sep 9 14:20:50 2002 +++ current/net/edit_host.cgi Mon Sep 9 15:09:06 2002 @@ -3,12 +3,13 @@ # Edit or create a host address require './net-lib.pl'; -$access{'hosts'} == 2 || &error($text{'hosts_ecannot'}); &ReadParse(); if ($in{'new'}) { + $access{'hosts_add'} || &error($text{'hosts_acannot'}); &header($text{'hosts_create'}, ""); } else { + $access{'hosts'} == 2 || &error($text{'hosts_ecannot'}); &header($text{'hosts_edit'}, ""); @hosts = &list_hosts(); $h = $hosts[$in{'idx'}]; diff -ur .delta/net/lang/en current/net/lang/en --- .delta/net/lang/en Mon Sep 9 14:20:51 2002 +++ current/net/lang/en Mon Sep 9 15:09:27 2002 @@ -116,6 +116,8 @@ hosts_detail=Host and Addresses hosts_return=host addresses list hosts_ecannot=You are not allowed to edit host addresses +hosts_acannot=You are not allowed to add host addresses +hosts_vcannot=You are not allowed to view host addresses log_create_host=Created host address $1 log_delete_host=Deleted host address $1 @@ -134,6 +136,7 @@ acl_ifcs=Can edit network interfaces? acl_routes=Can edit routing and gateways? acl_dns=Can edit DNS client settings? +acl_hosts_add=Can add host addresses? acl_hosts=Can edit host addresses? acl_view=View only diff -ur .delta/net/list_hosts.cgi current/net/list_hosts.cgi --- .delta/net/list_hosts.cgi Mon Sep 9 14:20:50 2002 +++ current/net/list_hosts.cgi Mon Sep 9 15:08:32 2002 @@ -3,12 +3,12 @@ # List hosts from /etc/hosts require './net-lib.pl'; -$access{'hosts'} || &error($text{'hosts_ecannot'}); +$access{'hosts'} || &error($text{'hosts_vcannot'}); &header($text{'hosts_title'}, ""); print "<hr>\n"; print "<a href=\"edit_host.cgi?new=1\">$text{'hosts_add'}</a><br>\n" - if ($access{'hosts'} == 2); + if ($access{'hosts_add'}); print "<table border cellpadding=3>\n"; print "<tr $tb> <td><b>$text{'hosts_ip'}</b></td> ", "<td><b>$text{'hosts_host'}</b></td> </tr>\n"; @@ -26,7 +26,7 @@ } print "</table>\n"; print "<a href=\"edit_host.cgi?new=1\">$text{'hosts_add'}</a>\n" - if ($access{'hosts'} == 2); + if ($access{'hosts_add'}); print "<p>\n"; print "<hr>\n"; |