Skip to content

Commit

Permalink
added HuntGroup support thanks to Filippo Maria Del Prete
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Dec 20, 2009
1 parent f231766 commit 3e3f8b0
Show file tree
Hide file tree
Showing 10 changed files with 1,040 additions and 7 deletions.
28 changes: 26 additions & 2 deletions config-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@
$configValues['CONFIG_DB_TBL_RADACCT'] = $_REQUEST['config_dbtbl_radacct'];

if (isset($_REQUEST['config_dbtbl_operators']))
$configValues['CONFIG_DB_TBL_DALOOPERATOR'] = $_REQUEST['config_dbtbl_operators'];
$configValues['CONFIG_DB_TBL_DALOOPERATORS'] = $_REQUEST['config_dbtbl_operators'];

if (isset($_REQUEST['config_dbtbl_operators_acl']))
$configValues['CONFIG_DB_TBL_DALOOPERATORS_ACL'] = $_REQUEST['config_dbtbl_operators_acl'];

if (isset($_REQUEST['config_dbtbl_operators_acl_files']))
$configValues['CONFIG_DB_TBL_DALOOPERATORS_ACL_FILES'] = $_REQUEST['config_dbtbl_operators_acl_files'];

if (isset($_REQUEST['config_dbtbl_rates']))
$configValues['CONFIG_DB_TBL_DALOBILLINGRATES'] = $_REQUEST['config_dbtbl_rates'];
Expand Down Expand Up @@ -107,6 +113,8 @@
if (isset($_REQUEST['config_dbtbl_billinginfo']))
$configValues['CONFIG_DB_TBL_DALOUSERBILLINFO'] = $_REQUEST['config_dbtbl_billinginfo'];

if (isset($_REQUEST['config_dbtbl_hunt']))
$configValues['CONFIG_DB_TBL_RADHG'] = $_REQUEST['config_dbtbl_hunt'];


include ("library/config_write.php");
Expand Down Expand Up @@ -246,6 +254,12 @@
<input value="<?php echo $configValues['CONFIG_DB_TBL_RADNAS'] ?>" name="config_dbtbl_nas" />
</li>


<li class='fieldset'>
<label for='config_dbtbl_hunt' class='form'><?php echo $l['all']['hunt']?></label>
<input value="<?php echo $configValues['CONFIG_DB_TBL_RADHG'] ?>" name="config_dbtbl_hunt" />
</li>

<li class='fieldset'>
<label for='config_dbtbl_radpostauth' class='form'><?php echo $l['all']['radpostauth']?></label>
<input value="<?php echo $configValues['CONFIG_DB_TBL_RADPOSTAUTH'] ?>" name="config_dbtbl_radpostauth" />
Expand Down Expand Up @@ -303,7 +317,17 @@

<li class='fieldset'>
<label for='config_dbtbl_operators' class='form'><?php echo $l['all']['operators']?></label>
<input value="<?php echo $configValues['CONFIG_DB_TBL_DALOOPERATOR'] ?>" name="config_dbtbl_operators" />
<input value="<?php echo $configValues['CONFIG_DB_TBL_DALOOPERATORS'] ?>" name="config_dbtbl_operators" />
</li>

<li class='fieldset'>
<label for='config_dbtbl_operators_acl' class='form'><?php echo $l['all']['operators_acl']?></label>
<input value="<?php echo $configValues['CONFIG_DB_TBL_DALOOPERATORS_ACL'] ?>" name="config_dbtbl_operators_acl" />
</li>

<li class='fieldset'>
<label for='config_dbtbl_operators_acl_files' class='form'><?php echo $l['all']['operators_acl_files']?></label>
<input value="<?php echo $configValues['CONFIG_DB_TBL_DALOOPERATORS_ACL_FILES'] ?>" name="config_dbtbl_operators_acl_files" />
</li>

<li class='fieldset'>
Expand Down
23 changes: 23 additions & 0 deletions include/management/dynamicAutocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@
}


/* getAjaxAutocompleteHGHost */
if(isset($_GET['getAjaxAutocompleteHGHost'])) {

$getAjaxAutocompleteHGHost = $_GET['getAjaxAutocompleteHGHost'];

if ( (isset($getAjaxAutocompleteHGHost)) && ($getAjaxAutocompleteHGHost) ) {

include '../../library/opendb.php';

$sql = "SELECT distinct(nasipaddress) as nasipaddress FROM ".$configValues['CONFIG_DB_TBL_RADHG'].
" WHERE nasipaddress LIKE '$getAjaxAutocompleteHGHost%' ORDER BY nasipaddress ASC";
$res = $dbSocket->query($sql);

while($row = $res->fetchRow()) {
echo "$row[0]###$row[0]|";
}

include '../../library/closedb.php';
}

}



/* getAjaxAutocompleteGroupName */
if(isset($_GET['getAjaxAutocompleteGroupName'])) {
Expand Down
2 changes: 1 addition & 1 deletion include/menu/management-subnav.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<li><a href="mng-rad-nas.php"><em>N</em>as</a></li>
<li><a href="mng-rad-usergroup.php"><em>U</em>ser-Groups</a></li>
<li><a href="mng-rad-profiles.php"><em>P</em>rofiles</a></li>

<li><a href="mng-rad-hunt.php">HuntG<em>r</em>oups</a></li>
<li><a href="mng-rad-attributes.php"><em>A</em>ttributes</a></li>
<li><a href="mng-rad-realms.php"><em>R</em>ealms/Proxys </a></li>
<li><a href="mng-rad-ippool.php"><em>I</em>P-Pool </a></li>
Expand Down
45 changes: 41 additions & 4 deletions lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@

$l['all']['FramedIPAddress'] = "Framed-IP-Address";
$l['all']['SimultaneousUse'] = "Simultaneous-Use";
$l['all']['HgID'] = "HG ID";
$l['all']['Hg'] = "HG ";
$l['all']['HgIPHost'] = "HG IP/Host";
$l['all']['HgGroupName'] = "HG GroupName";
$l['all']['HgPortId'] = "HG Port Id";
$l['all']['NasID'] = "NAS ID";
$l['all']['Nas'] = "NAS ";
$l['all']['NasIPHost'] = "NAS IP/Host";
Expand Down Expand Up @@ -244,9 +249,12 @@
$l['all']['usergroup'] = "usergroup";
$l['all']['radacct'] = "radacct";
$l['all']['operators'] = "operators";
$l['all']['operators_acl'] = "operators_acl";
$l['all']['operators_acl_files'] = "operators_acl_files";
$l['all']['billingrates'] = "billing rates";
$l['all']['hotspots'] = "hotspots";
$l['all']['nas'] = "nas";
$l['all']['hunt'] = "radhuntgroup";
$l['all']['radpostauth'] = "radpostauth";
$l['all']['radippool'] = "radippool";
$l['all']['userinfo'] = "userinfo";
Expand Down Expand Up @@ -451,7 +459,10 @@
$l['Tooltip']['HotspotEdit'] = "Edit Hotspot";
$l['Tooltip']['EditNAS'] = "Edit NAS";
$l['Tooltip']['RemoveNAS'] = "Remove NAS";

$l['Tooltip']['EditHG'] = "Edit HuntGroup";
$l['Tooltip']['RemoveHG'] = "Remove HuntGroup";
$l['Tooltip']['hgNasIpAddress'] = "Type the Host/Ip address";
$l['Tooltip']['hgNasPortId'] = "Type the Nas Port Id";
$l['Tooltip']['EditUserGroup'] = "Edit User Group";
$l['Tooltip']['ListUserGroups'] = "List User Groups";

Expand Down Expand Up @@ -580,7 +591,10 @@
$l['button']['NewNAS'] = "New NAS";
$l['button']['EditNAS'] = "Edit NAS";
$l['button']['RemoveNAS'] = "Remove NAS";

$l['button']['ListHG'] = "List HuntGroup";
$l['button']['NewHG'] = "New HuntGroup";
$l['button']['EditHG'] = "Edit HuntGroup";
$l['button']['RemoveHG'] = "Remove HuntGroup";
$l['button']['ListUserGroup'] = "List User-Group Mappings";
$l['button']['ListUsersGroup'] = "List User's Group Mappings";
$l['button']['NewUserGroup'] = "New User-Group Mappings";
Expand Down Expand Up @@ -704,7 +718,7 @@

$l['title']['NASInfo'] = "NAS Info";
$l['title']['NASAdvanced'] = "NAS Advanced";

$l['title']['HGInfo'] = "HG Info";
$l['title']['UserInfo'] = "User Info";
$l['title']['BillingInfo'] = "Billing Info";

Expand Down Expand Up @@ -943,6 +957,12 @@
$l['Intro']['mngradnasedit.php'] = "Edit NAS Record";
$l['Intro']['mngradnasdel.php'] = "Remove NAS Record";

$l['Intro']['mngradhunt.php'] = "HuntGroup Configuration";
$l['Intro']['mngradhuntnew.php'] = "New HuntGroup Record";
$l['Intro']['mngradhuntlist.php'] = "HuntGroup Listing in Database";
$l['Intro']['mngradhuntedit.php'] = "Edit HuntGroup Record";
$l['Intro']['mngradhuntdel.php'] = "Remove HuntGroup Record";

$l['Intro']['mngradprofiles.php'] = "Profiles Configuration";
$l['Intro']['mngradprofilesedit.php'] = "Edit Profiles";
$l['Intro']['mngradprofilesduplicate.php'] = "Duplicate Profiles";
Expand Down Expand Up @@ -1142,7 +1162,24 @@
$l['helpPage']['mngradnaslist'] = "";
$l['helpPage']['mngradnasedit'] = "";


$l['helpPage']['mngradhunt'] = "Before starting work with HuntGroup, please read <a href='http://wiki.freeradius.org/SQL_Huntgroup_HOWTO' target='_blank'>http://wiki.freeradius.org/SQL_Huntgroup_HOWTO</a>.
<br/>
In particular:
...
<i>Locate the authorize section in your radiusd.conf or sites-enabled/defaut configuration file and edit it. At the top of the authorize section after the preprocess module insert these lines:</i>
<br/>
<pre>
update request {
Huntgroup-Name := \"%{sql:select groupname from radhuntgroup where nasipaddress=\\\"%{NAS-IP-Address}\\\"}\"
}
</pre>
<i> What this does is perform a lookup in the radhuntgroup table using the ip-address as a key to return the huntgroup name. It then adds an attribute/value pair to the request where the name of the attribute is Huntgroup-Name and it's value is whatever was returned from the SQL query. If the query did not find anything then the value is the empty string. </i>";


+$l['helpPage']['mngradhuntdel'] = "To remove a huntgroup entry from the database you must provide the ip/host and port id of the huntgroup";
+$l['helpPage']['mngradhuntnew'] = "";
+$l['helpPage']['mngradhuntlist'] = "";
+$l['helpPage']['mngradhuntedit'] = "";

$l['helpPage']['mnghsdel'] = "To remove a hotspot from the database you must provide the hotspot's name<br/>";
$l['helpPage']['mnghsedit'] = "You may edit below details for hotspot<br/>";
Expand Down
65 changes: 65 additions & 0 deletions menu-mng-rad-hunt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script src="library/javascript/rounded-corners.js" type="text/javascript"></script>
<script src="library/javascript/form-field-tooltip.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/form-field-tooltip.css" type="text/css" media="screen,projection" />

<body>
<?php
include_once ("lang/main.php");
?>
<div id="wrapper">
<div id="innerwrapper">

<?php
$m_active = "Management";
include_once ("include/menu/menu-items.php");
include_once ("include/menu/management-subnav.php");
include_once("include/management/autocomplete.php");
?>

<div id="sidebar">

<h2>Management</h2>

<h3>HuntGroup Management</h3>
<ul class="subnav">

<li><a href="mng-rad-hunt-list.php" tabindex=1><b>&raquo;</b><?php echo $l['button']['ListHG'] ?></a></li>
<li><a href="mng-rad-hunt-new.php" tabindex=2><b>&raquo;</b><?php echo $l['button']['NewHG'] ?></a></li>
<li><a href="javascript:document.mngradhuntedit.submit();" tabindex=3 ><b>&raquo;</b><?php echo $l['button']['EditHG'] ?></a>
<form name="mngradhuntedit" action="mng-rad-hunt-edit.php" method="get" class="sidebar">
<input name="nasipaddress" type="text" id="nashostEdit" <?php if ($autoComplete) echo "autocomplete='off'"; ?>
onClick='javascript:__displayTooltip();'
tooltipText='<?php echo $l['Tooltip']['hgNasIpAddress']; ?> <br/>'
tabindex=4>
<input name="nasportid" type="text" value=""
onClick='javascript:__displayTooltip();'
tooltipText='<?php echo $l['Tooltip']['hgNasPortId']; ?> <br/>'
/>

</form></li>
<li><a href="mng-rad-hunt-del.php" tabindex=5><b>&raquo;</b><?php echo $l['button']['RemoveHG'] ?></a></li>

</ul>

</div>

<?php
include_once("include/management/autocomplete.php");

if ($autoComplete) {
echo "<script type=\"text/javascript\">
autoComEdit = new DHTMLSuite.autoComplete();
autoComEdit.add('nashostEdit','include/management/dynamicAutocomplete.php','_small','getAjaxAutocompleteHGHost');
</script>";
}

?>

<script type="text/javascript">
var tooltipObj = new DHTMLgoodies_formTooltip();
tooltipObj.setTooltipPosition('right');
tooltipObj.setPageBgColor('#EEEEEE');
tooltipObj.setTooltipCornerSize(15);
tooltipObj.initFormFieldTooltip();
</script>

Loading

0 comments on commit 3e3f8b0

Please sign in to comment.