Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved some pages to be within admin route (#13782)
* Moved plugin admin pages to be within admin route * Wrap html transports page in admin check * Moved Port group controller to be admin protected * fixed tests
- Loading branch information
Showing
2 changed files
with
30 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
<?php | ||
|
||
// handle OAuth requests | ||
$request = request(); // grab the Request object | ||
if (Auth::user()->hasGlobalAdmin()) { | ||
// handle OAuth requests | ||
$request = request(); // grab the Request object | ||
|
||
if ($request->has('oauthtransport')) { | ||
// make sure transport is safe | ||
$validator = Validator::make($request->all(), ['oauthtransport' => 'required|alpha']); | ||
if ($request->has('oauthtransport')) { | ||
// make sure transport is safe | ||
$validator = Validator::make($request->all(), ['oauthtransport' => 'required|alpha']); | ||
|
||
if ($validator->passes()) { | ||
$transport_name = $request->get('oauthtransport'); | ||
$class = \LibreNMS\Alert\Transport::getClass($transport_name); | ||
if (class_exists($class)) { | ||
$transport = app($class); | ||
if ($transport->handleOauth($request)) { | ||
flash()->addSuccess("$transport_name added successfully."); | ||
} else { | ||
flash()->addError("$transport_name was not added. Check the log for details."); | ||
if ($validator->passes()) { | ||
$transport_name = $request->get('oauthtransport'); | ||
$class = \LibreNMS\Alert\Transport::getClass($transport_name); | ||
if (class_exists($class)) { | ||
$transport = app($class); | ||
if ($transport->handleOauth($request)) { | ||
flash()->addSuccess("$transport_name added successfully."); | ||
} else { | ||
flash()->addError("$transport_name was not added. Check the log for details."); | ||
} | ||
} | ||
} | ||
|
||
// remove get variables otherwise things will get double added | ||
echo '<script>window.history.replaceState(null, null, window.location.pathname);</script>'; | ||
} | ||
unset($request); | ||
|
||
// remove get variables otherwise things will get double added | ||
echo '<script>window.history.replaceState(null, null, window.location.pathname);</script>'; | ||
// print alert transports | ||
require_once 'includes/html/print-alert-transports.php'; | ||
} else { | ||
include 'includes/html/error-no-perm.inc.php'; | ||
} | ||
unset($request); | ||
|
||
// print alert transports | ||
require_once 'includes/html/print-alert-transports.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters