Commit f39dfbe5 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) change behaviour of associated nat rules...

(legacy) change behaviour of associated nat rules (https://github.com/opnsense/core/issues/695), show rule but 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.

(cherry picked from commit e1dd1839)
parent b4768d86
...@@ -425,12 +425,6 @@ $( document ).ready(function() { ...@@ -425,12 +425,6 @@ $( document ).ready(function() {
(isset($filterent['floating']) && $selected_if == 'FloatingRules')): (isset($filterent['floating']) && $selected_if == 'FloatingRules')):
$interface_has_rules = true; $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 // select icon
if ($filterent['type'] == "block" && empty($filterent['disabled'])) { if ($filterent['type'] == "block" && empty($filterent['disabled'])) {
$iconfn = "glyphicon-remove text-danger"; $iconfn = "glyphicon-remove text-danger";
...@@ -629,15 +623,26 @@ $( document ).ready(function() { ...@@ -629,15 +623,26 @@ $( document ).ready(function() {
<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"> <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> <span class="glyphicon glyphicon-arrow-left"></span>
</a> </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"> <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> <span class="glyphicon glyphicon-pencil"></span>
</a> </a>
<?php
endif;?>
<a id="del_<?=$i;?>" title="<?=gettext("delete rule"); ?>" data-toggle="tooltip" class="act_delete btn btn-default btn-xs"> <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> <span class="fa fa-trash text-muted"></span>
</a> </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");?>"> <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> <span class="fa fa-clone text-muted"></span>
</a> </a>
<?php
endif;?>
</td> </td>
</tr> </tr>
<?php <?php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment