From 25fc52767bb6092414ccf96f3be2562dff9a4ea0 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 17 Sep 2010 16:15:45 -0700 Subject: [PATCH] Schema download page --- acl/acl-lib.pl | 2 -- acl/edit_sql.cgi | 2 ++ acl/lang/en | 4 ++++ acl/save_sql.cgi | 6 ++++++ acl/schema.cgi | 17 +++++++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 acl/schema.cgi diff --git a/acl/acl-lib.pl b/acl/acl-lib.pl index f4291f0ac..169518abb 100755 --- a/acl/acl-lib.pl +++ b/acl/acl-lib.pl @@ -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 diff --git a/acl/edit_sql.cgi b/acl/edit_sql.cgi index 5c51771d9..ef68ecde1 100755 --- a/acl/edit_sql.cgi +++ b/acl/edit_sql.cgi @@ -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, diff --git a/acl/lang/en b/acl/lang/en index 08fbf39e0..d8196152c 100644 --- a/acl/lang/en +++ b/acl/lang/en @@ -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 Create DN 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 /etc/ldap/schema or /etc/openldap/schema as webmin.schema, then configuring the server to load that schema file. +schema_download=Download schema file : $1 diff --git a/acl/save_sql.cgi b/acl/save_sql.cgi index c51613303..4fe7bc5e6 100755 --- a/acl/save_sql.cgi +++ b/acl/save_sql.cgi @@ -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 index 000000000..215ca2f09 --- /dev/null +++ b/acl/schema.cgi @@ -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'},"

\n"; +print &ui_table_start(undef, undef, 2); +print &ui_table_row(undef, + "

".&html_escape(&read_file_contents("webmin.schema"))."
", 2); +print &ui_table_end(); +print &text('schema_download', 'webmin.schema'),"

\n"; + +&ui_print_footer("", $text{'index_return'}); +