Schema download page
authorJamie Cameron <jcameron@webmin.com>
Fri, 17 Sep 2010 23:15:45 +0000 (16:15 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 17 Sep 2010 23:15:45 +0000 (16:15 -0700)
acl/acl-lib.pl
acl/edit_sql.cgi
acl/lang/en
acl/save_sql.cgi
acl/schema.cgi [new file with mode: 0755]

index f4291f0..169518a 100755 (executable)
@@ -18,8 +18,6 @@ do 'md5-lib.pl';
 %access = &get_module_acl();
 $access{'switch'} = 0 if (&is_readonly_mode());
 
-# XXX LDAP support
-#      XXX schema test / creation?
 # XXX CHANGELOG / docs
 # XXX test with Virtualmin
 
index 5c51771..ef68ecd 100755 (executable)
@@ -73,6 +73,8 @@ push(@ldapgrid,
      $text{'sql_groupclass'},
      &ui_textbox("ldap_groupclass", $proto eq "ldap" && $args->{'groupclass'} ?
                                     $args->{'groupclass'} : "webminGroup",30));
+push(@ldapgrid,
+     &ui_submit($text{'sql_schema'}, 'schema'), "");
 $ldapgrid = &ui_grid_table(\@ldapgrid, 2, 100);
 
 print &ui_table_row(undef,
index 08fbf39..d819615 100644 (file)
@@ -427,6 +427,7 @@ sql_title3=Create Missing DN
 sql_dnerr=User and group database settings are valid, but the LDAP DN needed by Webmin is missing : $1
 sql_dnerr2=Click the <b>Create DN</b> button below to have it create automatically, or add it to your LDAP server manually.
 sql_makedn=Create DN
+sql_schema=Download LDAP Schema
 
 make_title=Create User and Group Tables
 make_err=Failed to create user and group tables
@@ -442,3 +443,6 @@ makedn_failed=.. creation failed : $1
 makedn_done=.. done
 makedn_still=Some problems were found even after DN creation : $1
 
+schema_title=Download LDAP Schema
+schema_desc=Before Webmin can use an LDAP server to store users and groups it must be configured to use the schema below. This can typically be done by saving the schema definition in <tt>/etc/ldap/schema</tt> or <tt>/etc/openldap/schema</tt> as <tt>webmin.schema</tt>, then configuring the server to load that schema file.
+schema_download=Download schema file : <a href=$1>$1</a>
index c516133..4fe7bc5 100755 (executable)
@@ -8,6 +8,12 @@ $access{'pass'} || &error($text{'sql_ecannot'});
 &error_setup($text{'sql_err'});
 $p = $in{'proto'};
 
+if ($in{'schema'}) {
+       # Redirect to schema download page
+       &redirect("schema.cgi");
+       return;
+       }
+
 # Parse inputs
 if ($p eq 'mysql' || $p eq 'postgresql' || $p eq 'ldap') {
        gethostbyname($in{$p."_host"}) ||
diff --git a/acl/schema.cgi b/acl/schema.cgi
new file mode 100755 (executable)
index 0000000..215ca2f
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/local/bin/perl
+# Just display the Webmin LDAP schema
+
+require './acl-lib.pl';
+$access{'pass'} || &error($text{'sql_ecannot'});
+
+&ui_print_unbuffered_header(undef, $text{'schema_title'}, "");
+
+print $text{'schema_desc'},"<p>\n";
+print &ui_table_start(undef, undef, 2);
+print &ui_table_row(undef,
+       "<pre>".&html_escape(&read_file_contents("webmin.schema"))."</pre>", 2);
+print &ui_table_end();
+print &text('schema_download', 'webmin.schema'),"<p>\n";
+
+&ui_print_footer("", $text{'index_return'});
+