Create shard admin user in setup

hg/feature/cdb-packed
kaetemi 10 years ago
parent 1acf0bf3ca
commit 9be5bfb5d7

@ -595,14 +595,7 @@ CREATE TABLE IF NOT EXISTS `neltool_users` (
UNIQUE KEY `user_login` (`user_name`),
KEY `user_group_id` (`user_group_id`),
KEY `user_active` (`user_active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `neltool_users`
--
INSERT INTO `neltool_users` (`user_id`, `user_name`, `user_password`, `user_group_id`, `user_created`, `user_active`, `user_logged_last`, `user_logged_count`, `user_menu_style`) VALUES
(1, 'guest', '084e0343a0486ff05530df6c705c8bb4', 1, 1405357395, 1, 0, 0, 0);
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

@ -1,30 +1,32 @@
<?php
require_once('../config.php');
define('NELTOOL_LOADED', true);
// database information for nel tool
define('NELTOOL_DBHOST','localhost');
define('NELTOOL_DBUSER','shard');
define('NELTOOL_DBPASS','');
define('NELTOOL_DBNAME','nel_tool');
define('NELTOOL_DBHOST', $cfg['db']['tool']['host']);
define('NELTOOL_DBUSER', $cfg['db']['tool']['user']);
define('NELTOOL_DBPASS', $cfg['db']['tool']['pass']);
define('NELTOOL_DBNAME', $cfg['db']['tool']['name']);
// site paths definitions
define('NELTOOL_SITEBASE',$_SERVER['PHP_SELF']);
define('NELTOOL_SYSTEMBASE',dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_SITEBASE', $_SERVER['PHP_SELF']);
define('NELTOOL_SYSTEMBASE', dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/');
define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/');
define('NELTOOL_RRDTOOL', '/usr/bin/rrdtool');
define('NELTOOL_RRDSYSBASE', NELTOOL_SYSTEMBASE . 'graphs_output/');
define('NELTOOL_RRDWEBBASE', NELTOOL_SITEBASE . 'graphs_output/');
define('NELTOOL_RRDTOOL', '/usr/bin/rrdtool');
define('NELTOOL_RRDSYSBASE', NELTOOL_SYSTEMBASE . 'graphs_output/');
define('NELTOOL_RRDWEBBASE', NELTOOL_SITEBASE . 'graphs_output/');
define('NELTOOL_SITETITLE', 'Ryzom Admin');
define('NELTOOL_SITETITLE', 'Ryzom Core Admin');
define('NELTOOL_SESSIONID', 'sid');
define('NELTOOL_DEBUG', true);
// SQL table names
define('NELDB_PREFIX', 'neltool_');
define('NELDB_PREFIX', 'neltool_');
// for later use
// the config table will gather some of the settings
@ -60,9 +62,9 @@
define('NELDB_RESTART_SEQUENCE_TABLE', NELDB_PREFIX .'restart_sequences');
define('VIEW_DELAY', 0);
define('HARDWARE_REFRESH', 600);
define('LOCK_TIMEOUT', 1800);
define('BG_IMG', 'imgs/bg_live.png');
define('HARDWARE_REFRESH', 600);
define('LOCK_TIMEOUT', 1800);
define('BG_IMG', 'imgs/bg_live.png');
$nel_user_group_levels = array(array( 'level_id' => 0,
'level_name' => 'Normal'),
@ -70,6 +72,6 @@
'level_name' => 'Administrator'),
);
$restart_notification_emails = array('vl@ryzom.com');
$restart_notification_emails = array('support@ryzomcore.org');
?>

@ -112,6 +112,8 @@ function update_database_structure($continue_r, $con, $file) {
<?php
$continue = true;
// Change to root directory
if (!chdir("../")) {
printalert("danger", "Cannot change to public PHP root directory");

@ -24,7 +24,6 @@ include('header.php');
</div>
<?php
$continue = true;
$roleService = isset($_POST["roleService"]) && $_POST["roleService"] == "on";
$roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on";
@ -173,7 +172,41 @@ include('header.php');
}
if ($roleService) {
// TODO: Create the default admin user
// Create the default shard admin user
if (!chdir("admin/")) {
printalert("danger", "Cannot change to admin tools directory");
$continue = false;
}
if ($continue) {
try {
require_once('common.php');
} catch (Exception $e) {
printalert("danger", "Failed to include NeL <em>admin/common.php</em>");
$continue = false;
}
}
if ($continue) {
try {
require_once('functions_tool_administration.php');
} catch (Exception $e) {
printalert("danger", "Failed to include NeL <em>admin/functions_tool_administration.php</em>");
$continue = false;
}
}
if ($continue) {
$adminGroup = 1;
$result = tool_admin_users_add($_POST["toolsAdminUsername"], $_POST["toolsAdminPassword"], (string)$adminGroup, (string)1);
if ($result == "") {
printalert("success", "Added shard admin to NeL tools database");
} else {
printalert("danger", "Failed to add shard admin to NeL tools database<br>" . htmlentities($result));
$continue = false;
}
}
if (!chdir("../")) {
printalert("danger", "Cannot change to public PHP root directory");
$continue = false;
}
}
if ($roleSupport) {

Loading…
Cancel
Save