Esempio n. 1
0
require_once $nagvis_path . 'server/core/functions/core.php';
/* Init NagVis */
$core = GlobalCore::getInstance();
if ($single_nagvis_user) {
    // Same user for all, read from options
    $userCentreon = $centreon_nagvis_single_user;
} else {
    // User connected in Centreon
    $userCentreon = $centreon->user->alias;
}
$error = '';
$listMap = array();
/* 
 * Create nagvis session to get list of available maps for the user
 */
$AUTH = new CoreAuthHandler();
if ($AUTH->checkUserExists($userCentreon)) {
    $credential = array('user' => $userCentreon);
    $AUTH->setTrustUsername(true);
    $AUTH->setLogoutPossible(true);
    $AUTH->passCredentials($credential);
    $_SESSION['logonModule'] = cfg('global', 'logonmodule');
    $_SESSION['authModule'] = $AUTH->getModule();
    $_SESSION['authCredentials'] = $credential;
    $_SESSION['authTrusted'] = $AUTH->authedTrusted();
    $_SESSION['authLogoutPossible'] = $AUTH->logoutSupported();
    if ($single_nagvis_user) {
        $listMap = $core->getAvailableMaps();
    } else {
        if ($AUTH->isAuthenticated()) {
            $AUTHORISATION = new CoreAuthorisationHandler();
Esempio n. 2
0
 *
 ******************************************************************************/
/*
* Url: Parse the url to know later what module and
*      action is called. The requested uri is splitted
*      into elements for later usage.
*/
$UHANDLER = new CoreUriHandler();
/*
* Session: Handle the user session
*/
$SHANDLER = new CoreSessionHandler();
/*
 * Authentication: Try to authenticate the user
 */
$AUTH = new CoreAuthHandler();
// Session: Logged in?
// -> Get credentials from session and check auth
if (!($AUTH->sessionAuthPresent() && $AUTH->isAuthenticatedSession())) {
    // ...otherwise try to auth the user
    // Logon Module?
    // -> Received data to check the auth? Then check auth!
    // -> Save to session if logon module told to do so!
    $logonModule = 'Core' . cfg('global', 'logonmodule');
    $logonModule = $logonModule == 'CoreLogonDialog' ? 'CoreLogonDialogHandler' : $logonModule;
    $MODULE = new $logonModule($CORE);
    $ret = $MODULE->check();
    // Maybe handle other module now
    if (is_array($ret)) {
        $UHANDLER->set('mod', $ret[0]);
        $UHANDLER->set('act', $ret[1]);
Esempio n. 3
0
}
// Include global defines
require $_nv_core_dir . '/defines/global.php';
require $_nv_core_dir . '/defines/matches.php';
// Include functions
require $_nv_core_dir . '/functions/autoload.php';
require $_nv_core_dir . '/functions/debug.php';
require $_nv_core_dir . '/functions/oldPhpVersionFixes.php';
require $_nv_core_dir . '/classes/CoreExceptions.php';
require $_nv_core_dir . '/functions/nagvisErrorHandler.php';
define('CONST_AJAX', true);
try {
    require $_nv_core_dir . '/functions/core.php';
    // Authenticate the user
    $SHANDLER = new CoreSessionHandler();
    $AUTH = new CoreAuthHandler();
    if (!($AUTH->sessionAuthPresent() && $AUTH->isAuthenticatedSession())) {
        // ...otherwise try to auth the user
        // Logon Module?
        // -> Received data to check the auth? Then check auth!
        // -> Save to session if logon module told to do so!
        $logonModule = 'Core' . cfg('global', 'logonmodule');
        $logonModule = $logonModule == 'CoreLogonDialog' ? 'CoreLogonDialogHandler' : $logonModule;
        $MODULE = new $logonModule(GlobalCore::getInstance());
        $ret = $MODULE->check();
    }
    if (!$AUTH->isAuthenticated()) {
        throw new NagVisException('Not authenticated.');
    }
    $username = $AUTH->getUser();
    if (!isset($_GET['backend_id'])) {