s4-streams: fixed handling of stream rename and overwrite
[Samba/cd1.git] / swat2 / install / provision.esp
blobc6511adb6675ddfc5246c37d9c4473d08761b10e
1 <% page_header("columns", "Provisioning", "install"); 
3   include("/scripting/forms.js");
4   libinclude("base.js");
5   libinclude("provision.js");
6 %>
8 <h1>Samba4 provisioning</h1>
11 var f = FormObj("Provisioning", 0, 2);
12 var i;
13 var lp = loadparm_init();
14 if ((session.authinfo.user_class == "ADMINISTRATOR")
15          || (session.authinfo.user_class == "SYSTEM")) {
17         if (lp.get("realm") == "") {
18                 lp.set("realm", lp.get("workgroup") + ".example.com");
19         }
21         var subobj = provision_guess();
22         /* Don't supply default password for web interface */
23         subobj.ADMINPASS = "";
25         f.add("REALM", "DNS Domain Name");
26         f.add("DOMAIN", "NetBIOS Domain Name");
27         f.add("HOSTNAME", "Hostname");
28         f.add("ADMINPASS", "Administrator Password", "password");
29         f.add("CONFIRM", "Confirm Password", "password");
30         f.add("DOMAINSID", "Domain SID");
31         f.add("HOSTIP", "Host IP");
32         f.add("DEFAULTSITE", "Default Site");
33         f.submit[0] = "Provision";
34         f.submit[1] = "Cancel";
36         if (form['submit'] == "Cancel") {
37                 redirect("/");
38         }
40         if (form['submit'] == "Provision") {
41                 for (r in form) {
42                         subobj[r] = form[r];
43                 }
44         }
46         for (i=0;i<f.element.length;i++) {
47                 f.element[i].value = subobj[f.element[i].name];
48         }
50         if (form['submit'] == "Provision") {
51         
52                 /* overcome an initially blank smb.conf */
53                 lp.set("realm", subobj.REALM);
54                 lp.set("workgroup", subobj.DOMAIN);
55                 lp.reload();
56                 var goodpass = (subobj.CONFIRM == subobj.ADMINPASS);
58                 var paths = provision_default_paths(subobj);
59                 provision_fix_subobj(subobj, paths);
61                 if (!goodpass) {
62                         write("<h3>Passwords don't match.  Please try again.</h3>");
63                         f.display();
64                 } else if (subobj.ADMINPASS == "") {
65                         write("<h3>You must choose an administrator password.  Please try again.</h3>");
66                         f.display();
67                 } else if (!provision_validate(subobj, writefln)) {
68                         f.display();
69                 } else {
70                         if (!provision(subobj, writefln, false, paths, 
71                                        session.authinfo.session_info, session.authinfo.credentials, false)) {
72                                 writefln("Provision failed!");
73                         } else if (!provision_dns(subobj, writefln, paths,
74                                                   session.authinfo.session_info, session.authinfo.credentials)) {
75                                 writefln("DNS Provision failed!");
76                         } else {
77                                 writefln("Provision Complete!");
78                         }
79                 }
80         } else {
81                 f.display();
82         }
83 } else {
84         redirect("/");
90 <% page_footer(); %>