Skip to content

Commit

Permalink
(legacy) change behaviour of associated nat rules (#695), show rule b…
Browse files Browse the repository at this point in the history
…ut hide edit and duplicate buttons

If for some reason a config has "typeless" rules, which don't belong to any active nat rule the user won't notice this anymore (and doesn't have the ability to remove them).
This can happen with imports from old configs for example or manually changed configs.
  • Loading branch information
AdSchellevis committed Feb 4, 2016
1 parent 26a8f68 commit e1dd183
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/www/firewall_rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,6 @@
(isset($filterent['floating']) && $selected_if == 'FloatingRules')):
$interface_has_rules = true;

if (!isset($filterent['type'])) {
// not very nice.... associated NAT rules don't have a type...
// NAT rules shouldn't leak into the rules screen, breaks on edit
continue;
}

// select icon
if ($filterent['type'] == "block" && empty($filterent['disabled'])) {
$iconfn = "glyphicon-remove text-danger";
Expand Down Expand Up @@ -629,15 +623,26 @@
<a id="move_<?=$i;?>" name="move_<?=$i;?>_x" data-toggle="tooltip" title="<?=gettext("move selected rules before this rule");?>" class="act_move btn btn-default btn-xs">
<span class="glyphicon glyphicon-arrow-left"></span>
</a>
<?php
// not very nice.... associated NAT rules don't have a type...
// if for some reason (broken config) a rule is in there which doesn't have a related nat rule
// make sure we are able to delete it.
if (isset($filterent['type'])):?>
<a href="firewall_rules_edit.php?id=<?=$i;?>" data-toggle="tooltip" title="<?=gettext("edit rule");?>" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<?php
endif;?>
<a id="del_<?=$i;?>" title="<?=gettext("delete rule"); ?>" data-toggle="tooltip" class="act_delete btn btn-default btn-xs">
<span class="fa fa-trash text-muted"></span>
</a>
<?php
if (isset($filterent['type'])):?>
<a href="firewall_rules_edit.php?dup=<?=$i;?>" class="btn btn-default btn-xs" data-toggle="tooltip" title="<?=gettext("clone rule");?>">
<span class="fa fa-clone text-muted"></span>
</a>
<?php
endif;?>
</td>
</tr>
<?php
Expand Down

0 comments on commit e1dd183

Please sign in to comment.