saml enable - initial testing
This commit is contained in:
43
users.php
43
users.php
@@ -23,11 +23,40 @@
|
||||
session_save_path('.tmp'); // TEMP
|
||||
session_start(); // START
|
||||
require_once __DIR__ . '/autoload.php'; // AUTOLOAD
|
||||
use App\LobbySIO\Config\Registry;
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (Registry::AUTHMETHOD == 'SAML') {
|
||||
//simplesaml
|
||||
require_once('../simplesamlphp/lib/_autoload.php');
|
||||
$auth = new \SimpleSAML\Auth\Simple(Registry::AUTHIDP);
|
||||
//$auth->requireAuth();
|
||||
$auth->isAuthenticated();
|
||||
if (!$auth->isAuthenticated()) {
|
||||
$attributes = 'none';
|
||||
} else {
|
||||
$attributes = $auth->getAttributes();
|
||||
$saml_user_email = $attributes['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'][0];
|
||||
$saml_user_info = $Users->getUserInfoByEmail($saml_user_email, "1", "0");
|
||||
$saml_user_id = $saml_user_info["0"]["users_id"];
|
||||
}
|
||||
$session = \SimpleSAML\Session::getSessionFromRequest();
|
||||
$session->cleanup();
|
||||
}
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
|
||||
if (isset($saml_user_id)) {
|
||||
$sessuserid=$saml_user_id;
|
||||
} else {
|
||||
$sessuserid=$_SESSION['user_id'];
|
||||
}
|
||||
} elseif (!isset($_SESSION['user_id'])) {
|
||||
if (isset($saml_user_id)) {
|
||||
$sessuserid=$saml_user_id;
|
||||
} else {
|
||||
$sessuserid=$_SESSION['user_id'];
|
||||
}
|
||||
$session_user = $Users->getUserInfo($sessuserid, "1", "0"); }
|
||||
if (isset($session_user)) { // GET UID OR SET TO KIOSK
|
||||
$uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
|
||||
$app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
|
||||
@@ -44,7 +73,7 @@
|
||||
$app_current_pagename = $transLang['ADMINISTRATION']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-list"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
if ($StaticFunctions->getUserSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
@@ -72,13 +101,13 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="firstname"><?php echo $transLang['FIRSTNAME']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo $edituser["0"]["users_firstname"]; ?>" required />
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo $edituser["0"]["users_firstname"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } else { echo "required "; } ?>/>
|
||||
</div>
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="lastname"><?php echo $transLang['LASTNAME']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo $edituser["0"]["users_lastname"]; ?>" required />
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo $edituser["0"]["users_lastname"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } else { echo "required "; } ?>/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@@ -86,13 +115,13 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="username"><?php echo $transLang['USERNAME']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="username" name="username" value="<?php echo $edituser["0"]["users_username"]; ?>" required />
|
||||
<input type="text" class="form-control" id="username" name="username" value="<?php echo $edituser["0"]["users_username"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } else { echo "required "; } ?>/>
|
||||
</div>
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="email"><?php echo $transLang['EMAIL']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="email" name="email" value="<?php echo $edituser["0"]["users_email"]; ?>" />
|
||||
<input type="text" class="form-control" id="email" name="email" value="<?php echo $edituser["0"]["users_email"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } else { echo "required "; } ?>/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
Reference in New Issue
Block a user