diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 8dbd3052e0..6921d42eae 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -33,6 +33,44 @@ * */ +/****f* pfsense-utils/have_natonetooneruleint_access + * NAME + * have_natonetooneruleint_access + * INPUTS + * none + * RESULT + * returns true if user has access to edit a specific firewall nat one to one interface + ******/ +function have_natonetooneruleint_access($if) { + global $config, $g, $HTTP_SERVER_VARS; + $allowed = $g['privs']; + if (isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + return true; + $security_url = "firewall_nat_1to1_edit.php?if=". strtolower($if); + if(in_array($security_url, $allowed)) + return true; + return false; +} + +/****f* pfsense-utils/have_natpfruleint_access + * NAME + * have_natpfruleint_access + * INPUTS + * none + * RESULT + * returns true if user has access to edit a specific firewall nat port forward interface + ******/ +function have_natpfruleint_access($if) { + global $config, $g, $HTTP_SERVER_VARS; + $allowed = $g['privs']; + if (isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + return true; + $security_url = "firewall_nat_edit.php?if=". strtolower($if); + if(in_array($security_url, $allowed)) + return true; + return false; +} + /****f* pfsense-utils/have_ruleint_access * NAME * have_ruleint_access