r8648: automatically redirect to provisioning if not yet provisioned when the
authorAndrew Tridgell <tridge@samba.org>
Wed, 20 Jul 2005 11:26:17 +0000 (11:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:29:49 +0000 (13:29 -0500)
home page in swat is accessed
(This used to be commit 78fb559c08d55c01f5ede81d43cdd857cce8d338)

source4/scripting/libjs/provision.js
swat/index.esp

index f5aaeaf..894b42c 100644 (file)
@@ -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
 */
index e1ec624..2e43d3f 100644 (file)
@@ -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");
+  }
+
 %>
 
 <h1>Server Status</h1>