summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_rules_edit.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-03-20 13:24:12 -0400
committerjim-p <jimp@pfsense.org>2013-03-20 13:26:16 -0400
commitba1d9714c5a96d892a6a80157d542f2dbe4fb71c (patch)
tree079bdc26e13959e111de0c3e70e1523e80ed1f16 /usr/local/www/firewall_rules_edit.php
parent919ff1f07070287ee1408ae4d8e530efa756106f (diff)
downloadpfsense-ba1d9714c5a96d892a6a80157d542f2dbe4fb71c.zip
pfsense-ba1d9714c5a96d892a6a80157d542f2dbe4fb71c.tar.gz
Track user/time a firewall rule was created and last updated, and show this information at the bottom of the page when viewing the firewall rule. Have various places in the system that create rules add a proper entry to indicate their origin.
Diffstat (limited to 'usr/local/www/firewall_rules_edit.php')
-rwxr-xr-xusr/local/www/firewall_rules_edit.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index b205c46..b3e3c5e 100755
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -78,6 +78,12 @@ if (isset($id) && $a_filter[$id]) {
if (isset($a_filter[$id]['id']))
$pconfig['ruleid'] = $a_filter[$id]['id'];
+ if ( isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created']) )
+ $pconfig['created'] = $a_filter[$id]['created'];
+
+ if ( isset($a_filter[$id]['updated']) && is_array($a_filter[$id]['updated']) )
+ $pconfig['updated'] = $a_filter[$id]['updated'];
+
if (!isset($a_filter[$id]['type']))
$pconfig['type'] = "pass";
else
@@ -636,12 +642,18 @@ if ($_POST) {
$filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
}
+ if ( isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created']) )
+ $filterent['created'] = $a_filter[$id]['created'];
+
+ $filterent['updated'] = make_config_revision_entry();
+
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_write_config");
if (isset($id) && $a_filter[$id])
$a_filter[$id] = $filterent;
else {
+ $filterent['created'] = make_config_revision_entry();
if (is_numeric($after))
array_splice($a_filter, $after+1, 0, array($filterent));
else
@@ -1559,6 +1571,34 @@ $i--): ?>
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/htmlphplate");
?>
+<?php
+$has_created_time = (isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created']));
+$has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id]['updated']));
+?>
+ <?php if ($has_created_time || $has_updated_time): ?>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Rule Information");?></td>
+ </tr>
+ <?php if ($has_created_time): ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Created");?></td>
+ <td width="78%" class="vtable">
+ <?= date(gettext("n/j/y H:i:s"), $a_filter[$id]['created']['time']) ?> <?= gettext("by") ?> <strong><?= $a_filter[$id]['created']['username'] ?></strong>
+ </td>
+ </tr>
+ <?php endif; ?>
+ <?php if ($has_updated_time): ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Updated");?></td>
+ <td width="78%" class="vtable">
+ <?= date(gettext("n/j/y H:i:s"), $a_filter[$id]['updated']['time']) ?> <?= gettext("by") ?> <strong><?= $a_filter[$id]['updated']['username'] ?></strong>
+ </td>
+ </tr>
+ <?php endif; ?>
+ <?php endif; ?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
OpenPOWER on IntegriCloud