Skip to content

Commit

Permalink
ACL option to hide DNS zone editing feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Oct 2, 2012
1 parent 1b07e4a commit df5b1af
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions dhcpd/acl_security.pl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ sub acl_security_form
$_[0]->{'w_leases'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_zones'}</b></td> <td>\n";
printf "<input type=radio name=zones value=1 %s> $text{'yes'}\n",
$_[0]->{'zones'} ? "checked" : "";
printf "<input type=radio name=zones value=0 %s> $text{'no'}</td>\n",
$_[0]->{'zones'} ? "" : "checked";
print "</tr>\n";

print "<tr> <td colspan=4><hr></td> </tr>\n";

# uniqs
Expand Down Expand Up @@ -170,6 +177,7 @@ sub acl_security_save
$_[0]->{'global'}=$in{'global'};
$_[0]->{'r_leases'}=$in{'r_leases'};
$_[0]->{'w_leases'}=$in{'w_leases'};
$_[0]->{'zones'}=$in{'zones'};
$_[0]->{'uniq_hst'}=$in{'uniq_hst'};
$_[0]->{'uniq_sub'}=$in{'uniq_sub'};
$_[0]->{'uniq_sha'}=$in{'uniq_sha'};
Expand Down
1 change: 1 addition & 0 deletions dhcpd/edit_zones.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require './dhcpd-lib.pl';
require './params-lib.pl';
&ReadParse();
$access{'zones'} || &error($text{'zone_ecannot'});
$conf = &get_config();
$in{'new'} || (($par, $zone) = &get_branch('zone'));
$sconf = $zone->{'members'};
Expand Down
2 changes: 1 addition & 1 deletion dhcpd/index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ print &ui_hr();

############ START ZONES #####

if ($config{'dhcpd_version'} >= 3) {
if ($config{'dhcpd_version'} >= 3 && $access{'zones'}) {
print &ui_subheading($text{'zone_key'});

# get zones
Expand Down
4 changes: 3 additions & 1 deletion dhcpd/lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ eacl_papply=restart this service
acl_apply=Can apply changes?
acl_r_leases=Can view leases?
acl_w_leases=Can remove leases?
acl_zones=Can edit dynamic DNS zones?
acl_global=Can edit global options?
acl_uniq_hst=Uniq host names?
acl_uniq_sub=Uniq subnet IP addresses?
Expand Down Expand Up @@ -432,7 +433,7 @@ lookup_esubnetname=No subnet address or address/netmask entered
lookup_eshared=No shared network with the name $1 exists
lookup_esharedname=No shared network name entered

zone_key=DNS-zones
zone_key=DNS Zones
index_addzone=Add a new DNS zone.
index_zone=Zone
index_nozones=No DNS zones have been defined yet.
Expand All @@ -446,6 +447,7 @@ zone_return=main menu
zone_faildel=Failed to delete zone
zone_failsave=Failed to save zone
zone_tsigkey=TSIG key
zone_ecannot=You are not allowed to edit DNS zones

plib_clientupdates=Can clients update their own records?

Expand Down
1 change: 1 addition & 0 deletions dhcpd/save_zones.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require './dhcpd-lib.pl';
require './params-lib.pl';
&ReadParse();
$access{'zones'} || &error($text{'zone_ecannot'});
&lock_file($config{'dhcpd_conf'});

unless ($in{'new'}){ # on change or delete
Expand Down

0 comments on commit df5b1af

Please sign in to comment.