Add the Access Controls as the new interface for ACL Lists.
This commit is contained in:
parent
55f32aa3c0
commit
7759f63c9d
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('access_control_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//get the id
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//delete access_control
|
||||
$sql = "delete from v_access_controls ";
|
||||
$sql .= "where access_control_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
$_SESSION['message'] = $text['message-delete'];
|
||||
header('Location: access_controls.php');
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('access_control_add') || permission_exists('access_control_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$access_control_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$access_control_name = check_str($_POST["access_control_name"]);
|
||||
$access_control_default = check_str($_POST["access_control_default"]);
|
||||
$access_control_description = check_str($_POST["access_control_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$access_control_uuid = check_str($_POST["access_control_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($access_control_name) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_name']."<br>\n"; }
|
||||
if (strlen($access_control_default) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_default']."<br>\n"; }
|
||||
if (strlen($access_control_description) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_description']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('access_control_add')) {
|
||||
$sql = "insert into v_access_controls ";
|
||||
$sql .= "(";
|
||||
$sql .= "access_control_uuid, ";
|
||||
$sql .= "access_control_name, ";
|
||||
$sql .= "access_control_default, ";
|
||||
$sql .= "access_control_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$access_control_name', ";
|
||||
$sql .= "'$access_control_default', ";
|
||||
$sql .= "'$access_control_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION['message'] = $text['message-add'];
|
||||
header('Location: access_controls.php');
|
||||
return;
|
||||
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('access_control_edit')) {
|
||||
$sql = "update v_access_controls set ";
|
||||
$sql .= "access_control_name = '$access_control_name', ";
|
||||
$sql .= "access_control_default = '$access_control_default', ";
|
||||
$sql .= "access_control_description = '$access_control_description' ";
|
||||
$sql .= "where access_control_uuid = '$access_control_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION['message'] = $text['message-update'];
|
||||
header('Location: access_controls.php');
|
||||
return;
|
||||
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$access_control_uuid = check_str($_GET["id"]);
|
||||
$sql = "select * from v_access_controls ";
|
||||
$sql .= "where access_control_uuid = '$access_control_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$access_control_name = $row["access_control_name"];
|
||||
$access_control_default = $row["access_control_default"];
|
||||
$access_control_description = $row["access_control_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-access_control']."</b></td>\n";
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='access_controls.php'\" value='".$text['button-back']."'>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-access_control_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='access_control_name' maxlength='255' value=\"$access_control_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-access_control_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-access_control_default']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='access_control_default'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($access_control_default == "allow") {
|
||||
echo " <option value='allow' selected='selected'>".$text['label-allow']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='allow'>".$text['label-allow']."</option>\n";
|
||||
}
|
||||
if ($access_control_default == "deny") {
|
||||
echo " <option value='deny' selected='selected'>".$text['label-deny']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='deny'>".$text['label-deny']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-access_control_default']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-access_control_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='access_control_description' maxlength='255' value=\"$access_control_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-access_control_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='access_control_uuid' value='$access_control_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
if ($action == "update") {
|
||||
require "access_control_nodes.php";
|
||||
}
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('access_control_node_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//get the id
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$access_control_uuid = check_str($_GET["access_control_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//delete access_control_node
|
||||
$sql = "delete from v_access_control_nodes ";
|
||||
$sql .= "where access_control_node_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
$_SESSION['message'] = $text['message-delete'];
|
||||
header('Location: access_control_node_edit.php?id='.$access_control_uuid);
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('access_control_node_add') || permission_exists('access_control_node_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$access_control_node_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//set the parent uuid
|
||||
if (strlen($_GET["access_control_uuid"]) > 0) {
|
||||
$access_control_uuid = check_str($_GET["access_control_uuid"]);
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$node_type = check_str($_POST["node_type"]);
|
||||
$node_cidr = check_str($_POST["node_cidr"]);
|
||||
$node_domain = check_str($_POST["node_domain"]);
|
||||
$node_description = check_str($_POST["node_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$access_control_node_uuid = check_str($_POST["access_control_node_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($node_type) == 0) { $msg .= $text['message-required']." ".$text['label-node_type']."<br>\n"; }
|
||||
//if (strlen($node_cidr) == 0) { $msg .= $text['message-required']." ".$text['label-node_cidr']."<br>\n"; }
|
||||
//if (strlen($node_domain) == 0) { $msg .= $text['message-required']." ".$text['label-node_domain']."<br>\n"; }
|
||||
//if (strlen($node_description) == 0) { $msg .= $text['message-required']." ".$text['label-node_description']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('access_control_node_add')) {
|
||||
$sql = "insert into v_access_control_nodes ";
|
||||
$sql .= "(";
|
||||
$sql .= "access_control_node_uuid, ";
|
||||
$sql .= "access_control_uuid, ";
|
||||
$sql .= "node_type, ";
|
||||
$sql .= "node_cidr, ";
|
||||
$sql .= "node_domain, ";
|
||||
$sql .= "node_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$access_control_uuid', ";
|
||||
$sql .= "'$node_type', ";
|
||||
$sql .= "'$node_cidr', ";
|
||||
$sql .= "'$node_domain', ";
|
||||
$sql .= "'$node_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION['message'] = $text['message-add'];
|
||||
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
||||
return;
|
||||
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('access_control_node_edit')) {
|
||||
$sql = "update v_access_control_nodes set ";
|
||||
$sql .= "access_control_uuid = '$access_control_uuid', ";
|
||||
$sql .= "node_type = '$node_type', ";
|
||||
$sql .= "node_cidr = '$node_cidr', ";
|
||||
$sql .= "node_domain = '$node_domain', ";
|
||||
$sql .= "node_description = '$node_description' ";
|
||||
$sql .= "where access_control_node_uuid = '$access_control_node_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION['message'] = $text['message-update'];
|
||||
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
||||
return;
|
||||
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$access_control_node_uuid = check_str($_GET["id"]);
|
||||
$sql = "select * from v_access_control_nodes ";
|
||||
$sql .= "where access_control_node_uuid = '$access_control_node_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$node_type = $row["node_type"];
|
||||
$node_cidr = $row["node_cidr"];
|
||||
$node_domain = $row["node_domain"];
|
||||
$node_description = $row["node_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-access_control_node']."</b></td>\n";
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='access_control_edit.php?id=$access_control_uuid'\" value='".$text['button-back']."'>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-node_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='node_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($node_type == "allow") {
|
||||
echo " <option value='allow' selected='selected'>".$text['label-allow']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='allow'>".$text['label-allow']."</option>\n";
|
||||
}
|
||||
if ($node_type == "deny") {
|
||||
echo " <option value='deny' selected='selected'>".$text['label-deny']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='deny'>".$text['label-deny']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-node_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-node_cidr']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='node_cidr' maxlength='255' value=\"$node_cidr\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-node_cidr']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-node_domain']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='node_domain' maxlength='255' value=\"$node_domain\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-node_domain']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-node_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='node_description' maxlength='255' value=\"$node_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-node_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='access_control_uuid' value='$access_control_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='access_control_node_uuid' value='$access_control_node_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('access_control_node_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-access_control_nodes']."</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_access_control_nodes ";
|
||||
$sql .= "where access_control_uuid = '$access_control_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 10;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_access_control_nodes ";
|
||||
$sql .= "where access_control_uuid = '$access_control_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('node_type', $text['label-node_type'], $order_by, $order);
|
||||
echo th_order_by('node_cidr', $text['label-node_cidr'], $order_by, $order);
|
||||
echo th_order_by('node_domain', $text['label-node_domain'], $order_by, $order);
|
||||
echo th_order_by('node_description', $text['label-node_description'], $order_by, $order);
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('access_control_node_add')) {
|
||||
echo "<a href='access_control_node_edit.php?access_control_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
if (permission_exists('access_control_node_edit')) {
|
||||
$tr_link = "href='access_control_node_edit.php?access_control_uuid=".$row['access_control_uuid']."&id=".$row['access_control_node_uuid']."'";
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['node_type']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['node_cidr']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['node_domain']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['node_description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('access_control_node_edit')) {
|
||||
echo "<a href='access_control_node_edit.php?access_control_uuid=".$row['access_control_uuid']."&id=".$row['access_control_node_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('access_control_node_delete')) {
|
||||
echo "<a href='access_control_node_delete.php?access_control_uuid=".$row['access_control_uuid']."&id=".$row['access_control_node_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('access_control_node_add')) {
|
||||
echo "<a href='access_control_node_edit.php?access_control_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
else {
|
||||
echo " ";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('access_control_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-access_controls']."</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " ".$text['description-access_control']."<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_access_controls ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 10;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_access_controls ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('access_control_name', $text['label-access_control_name'], $order_by, $order);
|
||||
echo th_order_by('access_control_default', $text['label-access_control_default'], $order_by, $order);
|
||||
echo th_order_by('access_control_description', $text['label-access_control_description'], $order_by, $order);
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('access_control_add')) {
|
||||
echo "<a href='access_control_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
if (permission_exists('access_control_edit')) {
|
||||
$tr_link = "href='access_control_edit.php?id=".$row['access_control_uuid']."'";
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['access_control_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['access_control_default']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['access_control_description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('access_control_edit')) {
|
||||
echo "<a href='access_control_edit.php?id=".$row['access_control_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('access_control_delete')) {
|
||||
echo "<a href='access_control_delete.php?id=".$row['access_control_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='4' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('access_control_add')) {
|
||||
echo "<a href='access_control_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
else {
|
||||
echo " ";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Access Controls';
|
||||
$apps[$x]['uuid'] = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||
$apps[$x]['category'] = '';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en-us'] = '';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'user';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'user';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_node_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'user';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_node_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_node_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'user';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'access_control_node_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_access_controls';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
//$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'access_control_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'access_control_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'access_control_default';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the default type.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'access_control_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the description';
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_access_control_nodes';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
//$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'access_control_node_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'access_control_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_access_control';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'access_control_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'node_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'node_cidr';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the IP CIDR range.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'node_domain';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the domain.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'node_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the description.';
|
||||
$z++;
|
||||
?>
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//if the number of rows is 0 then read the acl xml into the database
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//add the access control list to the database
|
||||
$sql = "select count(*) as num_rows from v_access_controls ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] == 0) {
|
||||
//find the file
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf/autoload_configs')) {
|
||||
$xml_file = '/usr/share/examples/fusionpbx/resources/templates/conf/autload_configs/acl.conf.xml';
|
||||
}
|
||||
elseif (file_exists('/usr/local/share/fusionpbx/resources/templates/conf/autoload_configs')) {
|
||||
$xml_file = '/usr/local/share/fusionpbx/resources/templates/conf/autoload_configs/acl.conf.xml';
|
||||
}
|
||||
else {
|
||||
$xml_file = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/conf/autoload_configs/acl.conf.xml';
|
||||
}
|
||||
|
||||
//load the xml and save it into an array
|
||||
$xml_string = file_get_contents($xml_file);
|
||||
$xml_object = simplexml_load_string($xml_string);
|
||||
$json = json_encode($xml_object);
|
||||
$conf_array = json_decode($json, true);
|
||||
|
||||
//process the array
|
||||
foreach($conf_array['network-lists']['list'] as $list) {
|
||||
//get the attributes
|
||||
$access_control_name = $list['@attributes']['name'];
|
||||
$access_control_default = $list['@attributes']['default'];
|
||||
|
||||
//insert the name, description
|
||||
$access_control_uuid = uuid();
|
||||
$sql = "insert into v_access_controls ";
|
||||
$sql .= "(";
|
||||
$sql .= "access_control_uuid, ";
|
||||
$sql .= "access_control_name, ";
|
||||
$sql .= "access_control_default ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$access_control_uuid."', ";
|
||||
$sql .= "'".check_str($access_control_name)."', ";
|
||||
$sql .= "'".check_str($access_control_default)."' ";
|
||||
$sql .= ")";
|
||||
//echo $sql."\n";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//normalize the array - needed because the array is inconsistent when there is only one row vs multiple
|
||||
if (strlen($list['node']['@attributes']['type']) > 0) {
|
||||
$list['node'][]['@attributes'] = $list['node']['@attributes'];
|
||||
unset($list['node']['@attributes']);
|
||||
}
|
||||
|
||||
//add the nodes
|
||||
foreach ($list['node'] as $row) {
|
||||
//get the name and value pair
|
||||
$node_type = $row['@attributes']['type'];
|
||||
$node_cidr = $row['@attributes']['cidr'];
|
||||
$node_domain = $row['@attributes']['domain'];
|
||||
//replace $${domain}
|
||||
if (strlen($node_domain) > 0) {
|
||||
$node_domain = str_replace("\$\${domain}", $domain_name, $node_domain);
|
||||
}
|
||||
//add the profile settings into the database
|
||||
$access_control_node_uuid = uuid();
|
||||
$sql = "insert into v_access_control_nodes ";
|
||||
$sql .= "(";
|
||||
$sql .= "access_control_node_uuid, ";
|
||||
$sql .= "access_control_uuid, ";
|
||||
$sql .= "node_type, ";
|
||||
$sql .= "node_cidr, ";
|
||||
$sql .= "node_domain ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$access_control_node_uuid."', ";
|
||||
$sql .= "'".$access_control_uuid."', ";
|
||||
$sql .= "'".$node_type."', ";
|
||||
$sql .= "'".$node_cidr."', ";
|
||||
$sql .= "'".$node_domain."' ";
|
||||
$sql .= ")";
|
||||
//echo $sql."\n";
|
||||
$db->exec(check_sql($sql));
|
||||
}
|
||||
}
|
||||
unset($prep_statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
|
||||
//Access Controls
|
||||
$text['title-access_controls']['en-us'] = 'Access Controls';
|
||||
$text['title-access_controls']['es-cl'] = '';
|
||||
$text['title-access_controls']['pt-pt'] = '';
|
||||
$text['title-access_controls']['fr-fr'] = '';
|
||||
|
||||
$text['title-access_control']['en-us'] = 'Access Control';
|
||||
$text['title-access_control']['es-cl'] = '';
|
||||
$text['title-access_control']['pt-pt'] = '';
|
||||
$text['title-access_control']['fr-fr'] = '';
|
||||
|
||||
$text['description-access_control']['en-us'] = 'Access control list can allow or deny ranges of IP addresses.';
|
||||
$text['description-access_control']['es-cl'] = '';
|
||||
$text['description-access_control']['pt-pt'] = '';
|
||||
$text['description-access_control']['fr-fr'] = '';
|
||||
|
||||
$text['label-access_control_name']['en-us'] = 'Name';
|
||||
$text['label-access_control_name']['es-cl'] = '';
|
||||
$text['label-access_control_name']['pt-pt'] = '';
|
||||
$text['label-access_control_name']['fr-fr'] = '';
|
||||
|
||||
$text['description-access_control_name']['en-us'] = 'Enter the name.';
|
||||
$text['description-access_control_name']['es-cl'] = '';
|
||||
$text['description-access_control_name']['pt-pt'] = '';
|
||||
$text['description-access_control_name']['fr-fr'] = '';
|
||||
|
||||
$text['label-access_control_default']['en-us'] = 'Default';
|
||||
$text['label-access_control_default']['es-cl'] = '';
|
||||
$text['label-access_control_default']['pt-pt'] = '';
|
||||
$text['label-access_control_default']['fr-fr'] = '';
|
||||
|
||||
$text['description-access_control_default']['en-us'] = 'Select the default type.';
|
||||
$text['description-access_control_default']['es-cl'] = '';
|
||||
$text['description-access_control_default']['pt-pt'] = '';
|
||||
$text['description-access_control_default']['fr-fr'] = '';
|
||||
|
||||
$text['label-access_control_description']['en-us'] = 'Description';
|
||||
$text['label-access_control_description']['es-cl'] = '';
|
||||
$text['label-access_control_description']['pt-pt'] = '';
|
||||
$text['label-access_control_description']['fr-fr'] = '';
|
||||
|
||||
$text['description-access_control_description']['en-us'] = 'Enter the description';
|
||||
$text['description-access_control_description']['es-cl'] = '';
|
||||
$text['description-access_control_description']['pt-pt'] = '';
|
||||
$text['description-access_control_description']['fr-fr'] = '';
|
||||
|
||||
$text['label-allow']['en-us'] = 'allow';
|
||||
$text['label-allow']['es-cl'] = '';
|
||||
$text['label-allow']['pt-pt'] = '';
|
||||
$text['label-allow']['fr-fr'] = '';
|
||||
|
||||
$text['label-deny']['en-us'] = 'deny';
|
||||
$text['label-deny']['es-cl'] = '';
|
||||
$text['label-deny']['pt-pt'] = '';
|
||||
$text['label-deny']['fr-fr'] = '';
|
||||
|
||||
$text['label-true']['en-us'] = 'true';
|
||||
$text['label-true']['es-cl'] = '';
|
||||
$text['label-true']['pt-pt'] = '';
|
||||
$text['label-true']['fr-fr'] = '';
|
||||
|
||||
$text['label-false']['en-us'] = 'false';
|
||||
$text['label-false']['es-cl'] = 'falso';
|
||||
$text['label-false']['pt-pt'] = 'falso';
|
||||
$text['label-false']['fr-fr'] = 'falso';
|
||||
|
||||
$text['button-add']['en-us'] = 'Add';
|
||||
$text['button-add']['es-cl'] = '';
|
||||
$text['button-add']['pt-pt'] = '';
|
||||
$text['button-add']['fr-fr'] = '';
|
||||
|
||||
$text['button-edit']['en-us'] = 'Edit';
|
||||
$text['button-edit']['es-cl'] = '';
|
||||
$text['button-edit']['pt-pt'] = '';
|
||||
$text['button-edit']['fr-fr'] = '';
|
||||
|
||||
$text['button-delete']['en-us'] = 'Delete';
|
||||
$text['button-delete']['es-cl'] = '';
|
||||
$text['button-delete']['pt-pt'] = '';
|
||||
$text['button-delete']['fr-fr'] = '';
|
||||
|
||||
$text['button-save']['en-us'] = 'Save';
|
||||
$text['button-save']['es-cl'] = '';
|
||||
$text['button-save']['pt-pt'] = 'Guardar';
|
||||
$text['button-save']['fr-fr'] = '';
|
||||
|
||||
$text['button-view']['en-us'] = 'View';
|
||||
$text['button-view']['es-cl'] = '';
|
||||
$text['button-view']['pt-pt'] = '';
|
||||
$text['button-view']['fr-fr'] = '';
|
||||
|
||||
$text['button-back']['en-us'] = 'Back';
|
||||
$text['button-back']['es-cl'] = '';
|
||||
$text['button-back']['pt-pt'] = 'Voltar';
|
||||
$text['button-back']['fr-fr'] = '';
|
||||
|
||||
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
|
||||
$text['confirm-delete']['es-cl'] = '';
|
||||
$text['confirm-delete']['pt-pt'] = '';
|
||||
$text['confirm-delete']['fr-fr'] = '';
|
||||
|
||||
$text['message-add']['en-us'] = 'Add Completed';
|
||||
$text['message-add']['es-cl'] = '';
|
||||
$text['message-add']['pt-pt'] = '';
|
||||
$text['message-add']['fr-fr'] = '';
|
||||
|
||||
$text['message-update']['en-us'] = 'Update Completed';
|
||||
$text['message-update']['es-cl'] = '';
|
||||
$text['message-update']['pt-pt'] = '';
|
||||
$text['message-update']['fr-fr'] = '';
|
||||
|
||||
$text['message-delete']['en-us'] = 'Delete Completed';
|
||||
$text['message-delete']['es-cl'] = '';
|
||||
$text['message-delete']['pt-pt'] = '';
|
||||
$text['message-delete']['fr-fr'] = '';
|
||||
|
||||
$text['message-required']['en-us'] = 'Please provide: ';
|
||||
$text['message-required']['es-cl'] = '';
|
||||
$text['message-required']['pt-pt'] = '';
|
||||
$text['message-required']['fr-fr'] = '';
|
||||
|
||||
//Nodes
|
||||
$text['title-access_control_nodes']['en-us'] = 'Nodes';
|
||||
$text['title-access_control_nodes']['es-cl'] = '';
|
||||
$text['title-access_control_nodes']['pt-pt'] = '';
|
||||
$text['title-access_control_nodes']['fr-fr'] = '';
|
||||
|
||||
$text['title-access_control_node']['en-us'] = 'Node';
|
||||
$text['title-access_control_node']['es-cl'] = '';
|
||||
$text['title-access_control_node']['pt-pt'] = '';
|
||||
$text['title-access_control_node']['fr-fr'] = '';
|
||||
|
||||
$text['description-access_control_node']['en-us'] = '';
|
||||
$text['description-access_control_node']['es-cl'] = '';
|
||||
$text['description-access_control_node']['pt-pt'] = '';
|
||||
$text['description-access_control_node']['fr-fr'] = '';
|
||||
|
||||
$text['label-node_type']['en-us'] = 'Type';
|
||||
$text['label-node_type']['es-cl'] = '';
|
||||
$text['label-node_type']['pt-pt'] = '';
|
||||
$text['label-node_type']['fr-fr'] = '';
|
||||
|
||||
$text['description-node_type']['en-us'] = 'Select the type.';
|
||||
$text['description-node_type']['es-cl'] = '';
|
||||
$text['description-node_type']['pt-pt'] = '';
|
||||
$text['description-node_type']['fr-fr'] = '';
|
||||
|
||||
$text['label-node_cidr']['en-us'] = 'CIDR';
|
||||
$text['label-node_cidr']['es-cl'] = '';
|
||||
$text['label-node_cidr']['pt-pt'] = '';
|
||||
$text['label-node_cidr']['fr-fr'] = '';
|
||||
|
||||
$text['description-node_cidr']['en-us'] = 'Enter the IP CIDR range.';
|
||||
$text['description-node_cidr']['es-cl'] = '';
|
||||
$text['description-node_cidr']['pt-pt'] = '';
|
||||
$text['description-node_cidr']['fr-fr'] = '';
|
||||
|
||||
$text['label-node_domain']['en-us'] = 'Domain';
|
||||
$text['label-node_domain']['es-cl'] = '';
|
||||
$text['label-node_domain']['pt-pt'] = '';
|
||||
$text['label-node_domain']['fr-fr'] = '';
|
||||
|
||||
$text['description-node_domain']['en-us'] = 'Enter the domain name.';
|
||||
$text['description-node_domain']['es-cl'] = '';
|
||||
$text['description-node_domain']['pt-pt'] = '';
|
||||
$text['description-node_domain']['fr-fr'] = '';
|
||||
|
||||
$text['label-node_description']['en-us'] = 'Description';
|
||||
$text['label-node_description']['es-cl'] = '';
|
||||
$text['label-node_description']['pt-pt'] = '';
|
||||
$text['label-node_description']['fr-fr'] = '';
|
||||
|
||||
$text['description-node_description']['en-us'] = 'Enter the description.';
|
||||
$text['description-node_description']['es-cl'] = '';
|
||||
$text['description-node_description']['pt-pt'] = '';
|
||||
$text['description-node_description']['fr-fr'] = '';
|
||||
|
||||
$text['label-true']['en-us'] = 'true';
|
||||
$text['label-true']['es-cl'] = '';
|
||||
$text['label-true']['pt-pt'] = '';
|
||||
$text['label-true']['fr-fr'] = '';
|
||||
|
||||
$text['label-false']['en-us'] = 'false';
|
||||
$text['label-false']['es-cl'] = 'falso';
|
||||
$text['label-false']['pt-pt'] = 'falso';
|
||||
$text['label-false']['fr-fr'] = 'falso';
|
||||
|
||||
$text['button-add']['en-us'] = 'Add';
|
||||
$text['button-add']['es-cl'] = '';
|
||||
$text['button-add']['pt-pt'] = '';
|
||||
$text['button-add']['fr-fr'] = '';
|
||||
|
||||
$text['button-edit']['en-us'] = 'Edit';
|
||||
$text['button-edit']['es-cl'] = '';
|
||||
$text['button-edit']['pt-pt'] = '';
|
||||
$text['button-edit']['fr-fr'] = '';
|
||||
|
||||
$text['button-delete']['en-us'] = 'Delete';
|
||||
$text['button-delete']['es-cl'] = '';
|
||||
$text['button-delete']['pt-pt'] = '';
|
||||
$text['button-delete']['fr-fr'] = '';
|
||||
|
||||
$text['button-save']['en-us'] = 'Save';
|
||||
$text['button-save']['es-cl'] = '';
|
||||
$text['button-save']['pt-pt'] = 'Guardar';
|
||||
$text['button-save']['fr-fr'] = '';
|
||||
|
||||
$text['button-view']['en-us'] = 'View';
|
||||
$text['button-view']['es-cl'] = '';
|
||||
$text['button-view']['pt-pt'] = '';
|
||||
$text['button-view']['fr-fr'] = '';
|
||||
|
||||
$text['button-back']['en-us'] = 'Back';
|
||||
$text['button-back']['es-cl'] = '';
|
||||
$text['button-back']['pt-pt'] = 'Voltar';
|
||||
$text['button-back']['fr-fr'] = '';
|
||||
|
||||
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
|
||||
$text['confirm-delete']['es-cl'] = '';
|
||||
$text['confirm-delete']['pt-pt'] = '';
|
||||
$text['confirm-delete']['fr-fr'] = '';
|
||||
|
||||
$text['message-add']['en-us'] = 'Add Completed';
|
||||
$text['message-add']['es-cl'] = '';
|
||||
$text['message-add']['pt-pt'] = '';
|
||||
$text['message-add']['fr-fr'] = '';
|
||||
|
||||
$text['message-update']['en-us'] = 'Update Completed';
|
||||
$text['message-update']['es-cl'] = '';
|
||||
$text['message-update']['pt-pt'] = '';
|
||||
$text['message-update']['fr-fr'] = '';
|
||||
|
||||
$text['message-delete']['en-us'] = 'Delete Completed';
|
||||
$text['message-delete']['es-cl'] = '';
|
||||
$text['message-delete']['pt-pt'] = '';
|
||||
$text['message-delete']['fr-fr'] = '';
|
||||
|
||||
$text['message-required']['en-us'] = 'Please provide: ';
|
||||
$text['message-required']['es-cl'] = '';
|
||||
$text['message-required']['pt-pt'] = '';
|
||||
$text['message-required']['fr-fr'] = '';
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = 'Access Controls';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'bd47c972-5498-4541-b44a-d4bbfac69496';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/app/access_controls/access_controls.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue