do 'ldap-server-lib.pl';
-@acl_functions = ( 'slapd', 'schema', 'acl', 'browser', 'create' );
+@acl_functions = ( 'slapd', 'schema', 'acl', 'browser', 'create', 'start',
+ 'apply' );
# acl_security_form(&options)
# Output HTML for editing security options for the acl module
require './ldap-server-lib.pl';
&error_setup($text{'apply_err'});
+$access{'apply'} || &error($text{'apply_ecannot'});
$err = &apply_configuration();
&error($err) if ($err);
&webmin_log('apply');
--- /dev/null
+#!/usr/local/bin/perl
+# Enable or disable the LDAP server at boot
+
+require './ldap-server-lib.pl';
+&error_setup($text{'bootup_err'});
+&local_ldap_server() == 1 || &error($text{'slapd_elocal'});
+$access{'start'} || &error($text{'bootup_ecannot'});
+&ReadParse();
+
+&foreign_require("init", "init-lib.pl");
+$iname = $config{'init_name'} || $module_name;
+if ($in{'boot'}) {
+ $conf = &get_config();
+ $pidfile = &find_value("pidfile", $conf);
+ &init::enable_at_boot($iname, "Start OpenLDAP server",
+ "$config{'slapd'} 2>&1 </dev/null",
+ "kill `cat $pidfile`");
+ }
+else {
+ &init::disable_at_boot($iname);
+ }
+&webmin_log("boot", undef, $in{'boot'});
+&redirect("");
+
print "<hr>\n";
print &ui_buttons_start();
if (&is_ldap_server_running()) {
- print &ui_buttons_row("apply.cgi", $text{'index_apply'},
- $text{'index_applydesc'});
- print &ui_buttons_row("stop.cgi", $text{'index_stop'},
- $text{'index_stopdesc'});
+ if ($access{'apply'}) {
+ print &ui_buttons_row("apply.cgi", $text{'index_apply'},
+ $text{'index_applydesc'});
+ }
+ if ($access{'start'}) {
+ print &ui_buttons_row("stop.cgi", $text{'index_stop'},
+ $text{'index_stopdesc'});
+ }
}
else {
- print &ui_buttons_row("start.cgi", $text{'index_start'},
- $text{'index_startdesc'});
+ if ($access{'start'}) {
+ print &ui_buttons_row("start.cgi", $text{'index_start'},
+ $text{'index_startdesc'});
+ }
}
# Start at boot button
- if (&foreign_check("init")) {
- $iname = $config{'init_name'} || $module_name;
+ if (&foreign_check("init") && $access{'start'}) {
&foreign_require("init", "init-lib.pl");
+ $iname = $config{'init_name'} || $module_name;
$st = &init::action_status($iname);
print &ui_buttons_row("bootup.cgi", $text{'index_boot'},
$text{'index_bootdesc'},
- &ui_hidden("iname", $iname),
+ undef,
&ui_yesno_radio("boot",$st == 2 ? 1 : 0));
}
print &ui_buttons_end();
apply_err=Failed to apply configuration
apply_ecmd=$1 failed : $2
+apply_ecannot=You are not allowed to apply the configuration
stop_err=Failed to stop LDAP server
stop_ecmd=$1 failed : $2
stop_egone=No longer running!
stop_ekill=Kill process failed : $1
+stop_ecannot=You are not allowed to stop the LDAP server
start_err=Failed to start LDAP server
start_ecmd=$1 failed : $2
+start_ecannot=You are not allowed to start the LDAP server
log_create_dn=Created object $1
log_delete_dn=Deleted object $1
acl_acl=Can edit access control?
acl_browser=Can browse and edit database?
acl_create=Can create new tree?
+acl_start=Can start and stop LDAP server?
+acl_apply=Can apply configuration changes?
# Functions for configuring and talking to an LDAP server
# XXX help pages
# XXX init ldap server
-# XXX start at boot
+# XXX acl section
do '../web-lib.pl';
&init_config();
require './ldap-server-lib.pl';
&error_setup($text{'start_err'});
+$access{'start'} || &error($text{'start_ecannot'});
$err = &start_ldap_server();
&error($err) if ($err);
&webmin_log('start');
require './ldap-server-lib.pl';
&error_setup($text{'stop_err'});
+$access{'start'} || &error($text{'stop_ecannot'});
$err = &stop_ldap_server();
&error($err) if ($err);
&webmin_log('stop');