mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Remove $_SESSION usage, except install (#10745)
* Remove $_SESSION usage, except install Fixes issue with device debug capture Removes secure_cookies setting, use the .env variable SESSION_SECURE_COOKIE instead. Reminder secure cookies requires cookies are transported over https, if everything is already transported via https, the setting won't make a difference. * Fix availability map controls
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* AvailabilityMapController.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2019 Tony Murray
|
||||
* @author Tony Murray <[email protected]>
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Ajax;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AvailabilityMapController extends Controller
|
||||
{
|
||||
public function setView(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'map_view' => 'required|numeric|in:0,1,2'
|
||||
]);
|
||||
|
||||
return $this->setSessionValue($request, 'map_view');
|
||||
}
|
||||
|
||||
public function setGroup(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'group_view' => 'required|numeric'
|
||||
]);
|
||||
|
||||
return $this->setSessionValue($request, 'group_view');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $key
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
private function setSessionValue($request, $key)
|
||||
{
|
||||
$value = $request->get($key);
|
||||
$request->session()->put($key, $value);
|
||||
|
||||
return response()->json([$key, $value]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user