From 2fd92cb1b4986909aff79ee88e48d1bb513e9062 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 20 Jul 2005 11:26:17 +0000 Subject: r8648: automatically redirect to provisioning if not yet provisioned when the home page in swat is accessed (This used to be commit 78fb559c08d55c01f5ede81d43cdd857cce8d338) --- source4/scripting/libjs/provision.js | 21 +++++++++++++++++++++ swat/index.esp | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index f5aaeafe89..894b42ceb7 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -9,6 +9,27 @@ provision_next_usn = 1; sys = sys_init(); +/* + return true if the current install seems to be OK +*/ +function install_ok() +{ + var lp = loadparm_init(); + var ldb = ldb_init(); + if (lp.get("realm") == "") { + return false; + } + var ok = ldb.connect(lp.get("sam database")); + if (!ok) { + return false; + } + var res = ldb.search("(name=Administrator)"); + if (res.length != 1) { + return false; + } + return true; +} + /* find a user or group from a list of possibilities */ diff --git a/swat/index.esp b/swat/index.esp index e1ec624308..2e43d3f9cf 100644 --- a/swat/index.esp +++ b/swat/index.esp @@ -1,6 +1,12 @@ <% page_header("columns", "Server Status", ""); libinclude("base.js"); libinclude("management.js"); + libinclude("provision.js"); + + if (install_ok() == false) { + redirect("/install/provision.esp"); + } + %>

Server Status

-- cgit