fixed raspberry authentication for getConfig and removed IP verifiing
This commit is contained in:
@@ -60,10 +60,9 @@ class RaspberryDisplayController extends mfBaseController
|
||||
}
|
||||
|
||||
protected function getConfig() {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$hostname = $this->request->hostname;
|
||||
|
||||
$displays = RaspberryDisplayModel::getByHostnameAndIp($hostname, $ip);
|
||||
$displays = RaspberryDisplayModel::getByHostname($hostname);
|
||||
|
||||
if ($displays === null) {
|
||||
die("No display found for this hostname and ip:" . $hostname . " X " . $ip);
|
||||
@@ -82,7 +81,7 @@ class RaspberryDisplayController extends mfBaseController
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
|
||||
if (!$this->me->is("employee") && !in_array($do, ["getDisplays", "change", "reboot"])) {
|
||||
if ($do !== "getConfig" && !$this->me->is("employee")) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ class RaspberryDisplayModel
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getByHostnameAndIp($hostname, $ip)
|
||||
public static function getByHostname($hostname)
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("RaspberryDisplay", "*", "hostname = '$hostname' AND ip_address = '$ip'");
|
||||
$res = $db->select("RaspberryDisplay", "*", "hostname = '$hostname'");
|
||||
//fetch 2 rows
|
||||
|
||||
if ($db->num_rows($res)) {
|
||||
|
||||
Reference in New Issue
Block a user