|
@@ -38,6 +38,10 @@ if (isset($_POST["ApplyForAll"])) {
|
|
|
$_POST["a_bind_mac"] = 0;
|
|
$_POST["a_bind_mac"] = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (empty($_POST["a_bind_ip"])) {
|
|
|
|
|
+ $_POST["a_bind_ip"] = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$a_enabled = $_POST["a_enabled"] * 1;
|
|
$a_enabled = $_POST["a_enabled"] * 1;
|
|
|
$a_dhcp = $_POST["a_dhcp"] * 1;
|
|
$a_dhcp = $_POST["a_dhcp"] * 1;
|
|
|
$a_dhcp_acl = $_POST["a_dhcp_acl"];
|
|
$a_dhcp_acl = $_POST["a_dhcp_acl"];
|
|
@@ -49,6 +53,7 @@ if (isset($_POST["ApplyForAll"])) {
|
|
|
$a_ou_id = $_POST["a_new_ou"] * 1;
|
|
$a_ou_id = $_POST["a_new_ou"] * 1;
|
|
|
|
|
|
|
|
$a_bind_mac = $_POST["a_bind_mac"] * 1;
|
|
$a_bind_mac = $_POST["a_bind_mac"] * 1;
|
|
|
|
|
+ $a_bind_ip = $_POST["a_bind_ip"] * 1;
|
|
|
|
|
|
|
|
$msg = "Massive User change!";
|
|
$msg = "Massive User change!";
|
|
|
LOG_WARNING($db_link, $msg);
|
|
LOG_WARNING($db_link, $msg);
|
|
@@ -96,8 +101,9 @@ if (isset($_POST["ApplyForAll"])) {
|
|
|
$all_ok = 0;
|
|
$all_ok = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $auth_list = get_records_sql($db_link, "SELECT id, mac FROM User_auth WHERE deleted=0 AND user_id=" . $val);
|
|
|
|
|
|
|
+ $auth_list = get_records_sql($db_link, "SELECT id, mac, ip FROM User_auth WHERE deleted=0 AND user_id=" . $val);
|
|
|
$b_mac = '';
|
|
$b_mac = '';
|
|
|
|
|
+ $b_ip = '';
|
|
|
if (!empty($auth_list)) {
|
|
if (!empty($auth_list)) {
|
|
|
foreach ($auth_list as $row) {
|
|
foreach ($auth_list as $row) {
|
|
|
if (empty($row)) {
|
|
if (empty($row)) {
|
|
@@ -106,6 +112,9 @@ if (isset($_POST["ApplyForAll"])) {
|
|
|
if (empty($b_mac) and !empty($row["mac"])) {
|
|
if (empty($b_mac) and !empty($row["mac"])) {
|
|
|
$b_mac = $row["mac"];
|
|
$b_mac = $row["mac"];
|
|
|
}
|
|
}
|
|
|
|
|
+ if (empty($b_ip) and !empty($row["ip"])) {
|
|
|
|
|
+ $b_ip = $row["ip"];
|
|
|
|
|
+ }
|
|
|
$ret = update_record($db_link, "User_auth", "id='" . $row["id"] . "'", $auth);
|
|
$ret = update_record($db_link, "User_auth", "id='" . $row["id"] . "'", $auth);
|
|
|
if (!$ret) {
|
|
if (!$ret) {
|
|
|
$all_ok = 0;
|
|
$all_ok = 0;
|
|
@@ -134,6 +143,28 @@ if (isset($_POST["ApplyForAll"])) {
|
|
|
LOG_INFO($db_link, "Remove auto rule for user_id: " . $val . " and mac " . $b_mac);
|
|
LOG_INFO($db_link, "Remove auto rule for user_id: " . $val . " and mac " . $b_mac);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //bind ip rule
|
|
|
|
|
+ if (isset($_POST["e_bind_ip"])) {
|
|
|
|
|
+ if ($a_bind_ip) {
|
|
|
|
|
+ if (!empty($b_ip)) {
|
|
|
|
|
+ $auth_rules_user = get_record_sql($db_link, "SELECT * FROM auth_rules WHERE user_id=" . $val . " AND type=1");
|
|
|
|
|
+ $auth_rules_ip = get_record_sql($db_link, "SELECT * FROM auth_rules WHERE rule='" . $b_ip . "' AND type=1");
|
|
|
|
|
+ if (empty($auth_rules_user) and empty($auth_rules_ip)) {
|
|
|
|
|
+ $new['user_id'] = $val;
|
|
|
|
|
+ $new['type'] = 1;
|
|
|
|
|
+ $new['rule'] = $b_ip;
|
|
|
|
|
+ insert_record($db_link, "auth_rules", $new);
|
|
|
|
|
+ LOG_INFO($db_link, "Created auto rule for user_id: " . $val . " and ip " . $b_ip);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LOG_INFO($db_link, "Auto rule for user_id: " . $val . " and ip " . $ip . " already exists");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ run_sql($db_link, "DELETE FROM auth_rules WHERE user_id=" . $val . " AND type=1");
|
|
|
|
|
+ LOG_INFO($db_link, "Remove auto rule for user_id: " . $val . " and ip " . $b_ip);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if ($all_ok) {
|
|
if ($all_ok) {
|