Create shard admin user in setup
This commit is contained in:
parent
2a6edf5c0f
commit
f46cb42bed
4 changed files with 55 additions and 25 deletions
|
@ -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,16 +1,18 @@
|
|||
<?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/');
|
||||
|
||||
|
@ -18,7 +20,7 @@
|
|||
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);
|
||||
|
@ -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…
Reference in a new issue