示例#1
0
 public function __construct($CORE = null)
 {
     if ($CORE === null) {
         $this->CORE = GlobalCore::getInstance();
     } else {
         $this->CORE = $CORE;
     }
     $this->aRegistered = array();
     $this->sPrefix = 'CoreMod';
 }
示例#2
0
function automap_pos_check_preflight($params)
{
    GlobalCore::getInstance()->checkVarFolderWriteable(true);
    // Check all possibly used binaries of graphviz
    automap_check_graphviz('dot');
    automap_check_graphviz('neato');
    automap_check_graphviz('twopi');
    automap_check_graphviz('circo');
    automap_check_graphviz('fdp');
}
示例#3
0
 public function createInitialDb()
 {
     $this->query('CREATE TABLE users (userId INTEGER, name VARCHAR(100), password VARCHAR(40), PRIMARY KEY(userId), UNIQUE(name))');
     $this->query('CREATE TABLE roles (roleId INTEGER, name VARCHAR(100), PRIMARY KEY(roleId), UNIQUE(name))');
     $this->query('CREATE TABLE perms (permId INTEGER, mod VARCHAR(100), act VARCHAR(100), obj VARCHAR(100), PRIMARY KEY(permId), UNIQUE(mod,act,obj))');
     $this->query('CREATE TABLE users2roles (userId INTEGER, roleId INTEGER, PRIMARY KEY(userId, roleId))');
     $this->query('CREATE TABLE roles2perms (roleId INTEGER, permId INTEGER, PRIMARY KEY(roleId, permId))');
     $this->createVersionTable();
     // If running in OMD create the 'omdadmin' user instead of 'admin'
     if (GlobalCore::getInstance()->omdSite() !== null) {
         $this->query('INSERT INTO users (userId, name, password) VALUES (1, \'omdadmin\', \'051e0bbcfb79ea2a3ce5c487cc111051aac51ae8\')');
     } else {
         $this->query('INSERT INTO users (userId, name, password) VALUES (1, \'admin\', \'868103841a2244768b2dbead5dbea2b533940e20\')');
     }
     $this->query('INSERT INTO users (userId, name, password) VALUES (2, \'guest\', \'a4e74a1d28ec981c945310d87f8d7b535d794cd2\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (1, \'Administrators\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (2, \'Users (read-only)\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (3, \'Guests\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (4, \'Managers\')');
     // Access controll: Full access to everything
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'*\', \'*\', \'*\')');
     // Access controll: Overview module levels
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Overview\', \'view\', \'*\')');
     // Access controll: Access to all General actions
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'General\', \'*\', \'*\')');
     // Create permissions for Action/peform/*
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Action\', \'perform\', \'*\')');
     // Access controll: Map module levels for the demo maps
     foreach (GlobalCore::getInstance()->demoMaps as $map) {
         $this->createMapPermissions($map);
     }
     // Access controll: Rotation module levels for rotation "demo"
     $this->createRotationPermissions('demo');
     // Access controll: Change user options
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'User\', \'setOption\', \'*\')');
     // Access controll: Change own password
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'ChangePassword\', \'change\', \'*\')');
     // Access controll: View maps via multisite
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Multisite\', \'getMaps\', \'*\')');
     // Access controll: Search objects on maps
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Search\', \'view\', \'*\')');
     // Access controll: Authentication: Logout
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Auth\', \'logout\', \'*\')');
     // Access controll: Summary permissions for viewing/editing/deleting all maps
     $this->createMapPermissions('*');
     // Access controll: Rotation module levels for viewing all rotations
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Rotation\', \'view\', \'*\')');
     // Access controll: Manage users
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'UserMgmt\', \'manage\', \'*\')');
     // Access controll: Manage roles
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'RoleMgmt\', \'manage\', \'*\')');
     // Access control: WUI Management pages
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'ManageBackgrounds\', \'manage\', \'*\')');
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'ManageShapes\', \'manage\', \'*\')');
     // Access controll: Edit/Delete maps
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Map\', \'manage\', \'*\')');
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Map\', \'add\', \'*\')');
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'MainCfg\', \'edit\', \'*\')');
     // Access control: View URLs e.g. in rotation pools
     $this->query('INSERT INTO perms (mod, act, obj) VALUES (\'Url\', \'view\', \'*\')');
     // Assign the new permission to the managers, users, guests
     $RES = $this->query('SELECT roleId FROM roles WHERE name=\'Managers\' or name=\'Users (read-only)\' or name=\'Guests\'');
     while ($data = $this->fetchAssoc($RES)) {
         $this->addRolePerm($data['roleId'], 'Url', 'view', '*');
     }
     /*
      * Administrators handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Administrators\''));
     // Role assignment: admin => Administrators
     $this->query('INSERT INTO users2roles (userId, roleId) VALUES (1, ' . $data['roleId'] . ')');
     // Access assignment: Administrators => * * *
     $this->addRolePerm($data['roleId'], '*', '*', '*');
     /*
      * Managers handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Managers\''));
     // Permit all actions in General module
     $this->addRolePerm($data['roleId'], 'General', '*', '*');
     // Managers are allowed to perform actions
     $this->addRolePerm($data['roleId'], 'Action', 'perform', '*');
     // Access assignment: Managers => Allowed to update user options
     $this->addRolePerm($data['roleId'], 'User', 'setOption', '*');
     // Access assignment: Managers => Allowed to edit/delete all maps
     $this->addRolePerm($data['roleId'], 'Map', 'manage', '*');
     $this->addRolePerm($data['roleId'], 'Map', 'delete', '*');
     $this->addRolePerm($data['roleId'], 'Map', 'edit', '*');
     // Access assignment: Managers => Allowed to create maps
     $this->addRolePerm($data['roleId'], 'Map', 'add', '*');
     // Access assignment: Managers => Allowed to manage backgrounds and shapes
     $this->addRolePerm($data['roleId'], 'ManageBackgrounds', 'manage', '*');
     $this->addRolePerm($data['roleId'], 'ManageShapes', 'manage', '*');
     // Access assignment: Managers => Allowed to view the overview
     $this->addRolePerm($data['roleId'], 'Overview', 'view', '*');
     // Access assignment: Managers => Allowed to view all maps
     $this->addRolePerm($data['roleId'], 'Map', 'view', '*');
     // Access assignment: Managers => Allowed to view all rotations
     $this->addRolePerm($data['roleId'], 'Rotation', 'view', '*');
     // Access assignment: Managers => Allowed to change their passwords
     $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*');
     // Access assignment: Managers => Allowed to view their maps via multisite
     $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*');
     // Access assignment: Managers => Allowed to search objects
     $this->addRolePerm($data['roleId'], 'Search', 'view', '*');
     // Access assignment: Managers => Allowed to logout
     $this->addRolePerm($data['roleId'], 'Auth', 'logout', '*');
     /*
      * Users handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Users (read-only)\''));
     // Users are allowed to perform actions
     $this->addRolePerm($data['roleId'], 'Action', 'perform', '*');
     // Permit all actions in General module
     $this->addRolePerm($data['roleId'], 'General', '*', '*');
     // Access assignment: Users => Allowed to update user options
     $this->addRolePerm($data['roleId'], 'User', 'setOption', '*');
     // Access assignment: Users => Allowed to view the overview
     $this->addRolePerm($data['roleId'], 'Overview', 'view', '*');
     // Access assignment: Users => Allowed to view all maps
     $this->addRolePerm($data['roleId'], 'Map', 'view', '*');
     // Access assignment: Users => Allowed to view all rotations
     $this->addRolePerm($data['roleId'], 'Rotation', 'view', '*');
     // Access assignment: Users => Allowed to change their passwords
     $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*');
     // Access assignment: Users => Allowed to view their maps via multisite
     $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*');
     // Access assignment: Users => Allowed to search objects
     $this->addRolePerm($data['roleId'], 'Search', 'view', '*');
     // Access assignment: Users => Allowed to logout
     $this->addRolePerm($data['roleId'], 'Auth', 'logout', '*');
     /*
      * Guest handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Guests\''));
     // Role assignment: guest => Guests
     $this->query('INSERT INTO users2roles (userId, roleId) VALUES (2, ' . $data['roleId'] . ')');
     // Permit all actions in General module
     $this->addRolePerm($data['roleId'], 'General', '*', '*');
     // Access assignment: Guests => Allowed to update user options
     $this->addRolePerm($data['roleId'], 'User', 'setOption', '*');
     // Access assignment: Guests => Allowed to view the overview
     $this->addRolePerm($data['roleId'], 'Overview', 'view', '*');
     // Access assignment: Guests => Allowed to view their maps via multisite
     $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*');
     // Access assignment: Guests => Allowed to view the demo maps
     foreach (GlobalCore::getInstance()->demoMaps as $map) {
         $this->addRolePerm($data['roleId'], 'Map', 'view', $map);
     }
     // Access assignment: Guests => Allowed to view the demo rotation
     $this->addRolePerm($data['roleId'], 'Rotation', 'view', 'demo');
     // Access assignment: Guests => Allowed to change their passwords
     $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*');
     // Access assignment: Guests => Allowed to search objects
     $this->addRolePerm($data['roleId'], 'Search', 'view', '*');
     // Access assignment: Guests => Allowed to logout
     $this->addRolePerm($data['roleId'], 'Auth', 'logout', '*');
 }
示例#4
0
 /**
  * PRIVATE checkTemplateExists()
  *
  * Checks if the requested hover template file exists
  *
  * @param		Boolean		Switch for enabling/disabling error messages
  * @return	Boolean		Check Result
  * @author 	Lars Michelsen <*****@*****.**>
  */
 private function checkTemplateExists($printErr)
 {
     return GlobalCore::getInstance()->checkExisting($this->pathTemplateFile, $printErr);
 }
示例#5
0
 /**
  * Checks for writeable config file
  *
  * @param	Boolean $printErr
  * @return	Boolean	Is Successful?
  * @author 	Lars Michelsen <*****@*****.**>
  */
 function checkNagVisConfigWriteable($printErr)
 {
     return GlobalCore::getInstance()->checkWriteable($this->configFiles[count($this->configFiles) - 1], $printErr);
 }
示例#6
0
}
// Loading NagVis authentication type from options
$single_nagvis_user = $centreon_nagvis_auth === 'single';
/* Fix bad usage */
$_SERVER['SCRIPT_FILENAME'] = $nagvis_path . 'frontend/nagvis-js/index.php';
$tmpdir = getcwd();
chdir($nagvis_path . 'frontend/nagvis-js/');
// We now know where NagVis is located, so we can load it
require_once $nagvis_path . 'server/core/defines/global.php';
require_once $nagvis_path . 'server/core/defines/matches.php';
require_once $nagvis_path . 'server/core/functions/autoload.php';
require_once $nagvis_path . 'server/core/classes/CoreExceptions.php';
require_once $nagvis_path . 'server/core/functions/nagvisErrorHandler.php';
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);
示例#7
0
文件: std_lq.php 项目: rlugojr/nagvis
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'])) {
        throw new UserInputError('The parameter "backend_id" is missing.');
    }
    if (!isset($_GET['query'])) {
        throw new UserInputError('The parameter "query" is missing.');
    }
    if (!isset($_GET['type'])) {
        $type = 'raw';
    } else {
示例#8
0
文件: core.php 项目: rlugojr/nagvis
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * 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, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *****************************************************************************/
$CORE = GlobalCore::getInstance();
/*
 * l() needs to be available in MainCfg initialization and config parsing,
 * but GlobalLanguage initialization relies on the main configuration in
 * some parts.
 * The cleanest way to solve this problem is to skip the i18n in the main
 * configuration init code until all needed values are initialized and then
 * initialize the i18n code.
 */
// ----------------------------------------------------------------------------
$_MAINCFG = new GlobalMainCfg();
$_MAINCFG->init();
/**
 * This is mainly a short access to config options. In the past the whole
 * language object method call was used all arround NagVis. This has been
 * introduced to keep the code shorter
示例#9
0
 /**
  * Checks for existing cache file
  *
  * @param   Boolean  $printErr
  * @return  Boolean  Is Successful?
  * @author 	Lars Michelsen <*****@*****.**>
  */
 private function checkCacheFileExists($printErr)
 {
     return GlobalCore::getInstance()->checkExisting($this->cacheFile, $printErr);
 }
示例#10
0
 public function createInitialDb()
 {
     $this->query('CREATE TABLE users (userId INTEGER AUTO_INCREMENT, name VARCHAR(100), password VARCHAR(40), PRIMARY KEY(userId), UNIQUE(name))');
     $this->query('CREATE TABLE roles (roleId INTEGER AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY(roleId), UNIQUE(name))');
     $this->query('CREATE TABLE perms (`permId` INTEGER AUTO_INCREMENT, `mod` VARCHAR(100), `act` VARCHAR(100), `obj` VARCHAR(100), PRIMARY KEY(`permId`), UNIQUE(`mod`, `act`, `obj`))');
     $this->query('CREATE TABLE users2roles (userId INTEGER, roleId INTEGER, PRIMARY KEY(userId, roleId))');
     $this->query('CREATE TABLE roles2perms (roleId INTEGER, permId INTEGER, PRIMARY KEY(roleId, permId))');
     $this->query('CREATE TABLE version (version VARCHAR(100), PRIMARY KEY(version))');
     $this->query('INSERT INTO version (version) VALUES (\'' . CONST_VERSION . '\')');
     $this->query('INSERT INTO users (userId, name, password) VALUES (1, \'admin\', \'868103841a2244768b2dbead5dbea2b533940e20\')');
     $this->query('INSERT INTO users (userId, name, password) VALUES (2, \'guest\', \'7f09c620da83db16ef9b69abfb8edd6b849d2d2b\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (1, \'Administrators\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (2, \'Users (read-only)\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (3, \'Guests\')');
     $this->query('INSERT INTO roles (roleId, name) VALUES (4, \'Managers\')');
     // Access controll: Full access to everything
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'*\', \'*\', \'*\')');
     // Access controll: Overview module levels
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Overview\', \'view\', \'*\')');
     // Access controll: Access to all General actions
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'General\', \'*\', \'*\')');
     // Create permissions for Action/peform/*
     $this->createPerm('Action', 'perform', '*');
     // Access controll: Map module levels for demo maps
     foreach (GlobalCore::getInstance()->demoMaps as $map) {
         $this->createMapPermissions($map);
     }
     // Access controll: Rotation module levels for rotation "demo"
     $this->createRotationPermissions('demo');
     // Access controll: Change own password
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'ChangePassword\', \'change\', \'*\')');
     // Access controll: View maps via multisite
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Multisite\', \'getMaps\', \'*\')');
     // Access controll: Search objects on maps
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Search\', \'view\', \'*\')');
     // Access controll: Authentication: Logout
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Auth\', \'logout\', \'*\')');
     // Access controll: Summary permissions for viewing/editing/deleting all maps
     $this->createMapPermissions('*');
     // Access controll: Rotation module levels for viewing all rotations
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Rotation\', \'view\', \'*\')');
     // Access controll: Manage users
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'UserMgmt\', \'manage\', \'*\')');
     // Access controll: Manage roles
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'RoleMgmt\', \'manage\', \'*\')');
     // Access control: WUI Management pages
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'ManageBackgrounds\', \'manage\', \'*\')');
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'ManageShapes\', \'manage\', \'*\')');
     // Access controll: Edit/Delete maps
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Map\', \'manage\', \'*\')');
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Map\', \'add\', \'*\')');
     // Access control: View URLs e.g. in rotation pools
     $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Url\', \'view\', \'*\')');
     // Assign the new permission to the managers, users, guests
     $RES = $this->query('SELECT roleId FROM roles WHERE name=\'Managers\' or name=\'Users (read-only)\' or name=\'Guests\'');
     while ($data = $this->fetchAssoc($RES)) {
         $this->addRolePerm($data['roleId'], 'Url', 'view', '*');
     }
     /*
      * Administrators handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Administrators\''));
     // Role assignment: admin => Administrators
     $this->query('INSERT INTO users2roles (userId, roleId) VALUES (1, ' . $data['roleId'] . ')');
     // Access assignment: Administrators => * * *
     $this->addRolePerm($data['roleId'], '*', '*', '*');
     /*
      * Managers handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Managers\''));
     // Permit all actions in General module
     $this->addRolePerm($data['roleId'], 'General', '*', '*');
     // Managers are allowed to perform actions
     $this->addRolePerm($data['roleId'], 'Action', 'perform', '*');
     // Access assignment: Managers => Allowed to edit/delete all maps
     $this->addRolePerm($data['roleId'], 'Map', 'manage', '*');
     $this->addRolePerm($data['roleId'], 'Map', 'delete', '*');
     $this->addRolePerm($data['roleId'], 'Map', 'edit', '*');
     // Access assignment: Managers => Allowed to create maps
     $this->addRolePerm($data['roleId'], 'Map', 'add', '*');
     // Access assignment: Managers => Allowed to manage backgrounds and shapes
     $this->addRolePerm($data['roleId'], 'ManageBackgrounds', 'manage', '*');
     $this->addRolePerm($data['roleId'], 'ManageShapes', 'manage', '*');
     // Access assignment: Managers => Allowed to view the overview
     $this->addRolePerm($data['roleId'], 'Overview', 'view', '*');
     // Access assignment: Managers => Allowed to view all maps
     $this->addRolePerm($data['roleId'], 'Map', 'view', '*');
     // Access assignment: Managers => Allowed to view all rotations
     $this->addRolePerm($data['roleId'], 'Rotation', 'view', '*');
     // Access assignment: Managers => Allowed to change their passwords
     $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*');
     // Access assignment: Managers => Allowed to view their maps via multisite
     $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*');
     // Access assignment: Managers => Allowed to search objects
     $this->addRolePerm($data['roleId'], 'Search', 'view', '*');
     // Access assignment: Managers => Allowed to logout
     $this->addRolePerm($data['roleId'], 'Auth', 'logout', '*');
     /*
      * Users handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Users (read-only)\''));
     // Permit all actions in General module
     $this->addRolePerm($data['roleId'], 'General', '*', '*');
     // Users are allowed to perform actions
     $this->addRolePerm($data['roleId'], 'Action', 'perform', '*');
     // Access assignment: Users => Allowed to view the overview
     $this->addRolePerm($data['roleId'], 'Overview', 'view', '*');
     // Access assignment: Users => Allowed to view all maps
     $this->addRolePerm($data['roleId'], 'Map', 'view', '*');
     // Access assignment: Users => Allowed to view all rotations
     $this->addRolePerm($data['roleId'], 'Rotation', 'view', '*');
     // Access assignment: Users => Allowed to change their passwords
     $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*');
     // Access assignment: Users => Allowed to view their maps via multisite
     $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*');
     // Access assignment: Users => Allowed to search objects
     $this->addRolePerm($data['roleId'], 'Search', 'view', '*');
     // Access assignment: Users => Allowed to logout
     $this->addRolePerm($data['roleId'], 'Auth', 'logout', '*');
     /*
      * Guest handling
      */
     $data = $this->fetchAssoc($this->query('SELECT roleId FROM roles WHERE name=\'Guests\''));
     // Role assignment: guest => Guests
     $this->query('INSERT INTO users2roles (userId, roleId) VALUES (2, ' . $data['roleId'] . ')');
     // Permit all actions in General module
     $this->addRolePerm($data['roleId'], 'General', '*', '*');
     // Access assignment: Guests => Allowed to view the overview
     $this->addRolePerm($data['roleId'], 'Overview', 'view', '*');
     // Access assignment: Guests => Allowed to view the demo maps
     foreach (GlobalCore::getInstance()->demoMaps as $map) {
         $this->addRolePerm($data['roleId'], 'Map', 'view', $map);
     }
     // Access assignment: Guests => Allowed to view the demo rotation
     $this->addRolePerm($data['roleId'], 'Rotation', 'view', 'demo');
     // Access assignment: Guests => Allowed to change their passwords
     $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*');
     // Access assignment: Guests => Allowed to view their maps via multisite
     $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*');
     // Access assignment: Guests => Allowed to search objects
     $this->addRolePerm($data['roleId'], 'Search', 'view', '*');
     // Access assignment: Guests => Allowed to logout
     $this->addRolePerm($data['roleId'], 'Auth', 'logout', '*');
 }
示例#11
0
/**
 * Loads the hostname to object_id mapping table from the central file
 */
function automap_load_object_ids()
{
    global $automap_object_id_file, $automap_object_ids;
    if (!isset($automap_object_ids[0])) {
        if (GlobalCore::getInstance()->checkExisting($automap_object_id_file, false)) {
            $automap_object_ids = json_decode(file_get_contents($automap_object_id_file), true);
        } else {
            $automap_object_ids = array();
        }
    }
    return $automap_object_ids;
}