2010-08-10 Ramon Novoa <rnovoa@artica.es>
* godmode/setup/setup_auth.php: Added to repository. Authentication scheme setup options. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3114 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
575c7d6c48
commit
250ecbab70
|
@ -1,3 +1,8 @@
|
|||
2010-08-10 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* godmode/setup/setup_auth.php: Added to repository. Authentication
|
||||
scheme setup options.
|
||||
|
||||
010-08-10 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/auth/mysql.php, include/functions_config.php,
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
||||
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// Load enterprise extensions
|
||||
enterprise_include ('godmode/setup/setup_auth.php');
|
||||
|
||||
// Header
|
||||
print_page_header (__('Authentication configuration'), "", false, "", true);
|
||||
|
||||
$table->data = array ();
|
||||
$table->width = '90%';
|
||||
$table->size[0] = '30%';
|
||||
|
||||
$table->data[0][0] = __('Authentication method');
|
||||
$auth_methods = array ('mysql' => __('Local Pandora FMS'), __('ldap') => 'LDAP');
|
||||
enterprise_hook ('add_enterprise_auth_methods', array (&$auth_methods));
|
||||
$table->data[0][1] = print_select ($auth_methods, 'auth', $config['auth'], 'show_selected_rows ();', '', 0, true);
|
||||
|
||||
$table->data[1][0] = __('Autocreate remote users');
|
||||
$table->data[1][1] = __('Yes').' '.print_radio_button_extended ('autocreate_remote_users', 1, '', $config['autocreate_remote_users'], false, 'enable_profile_options ();', '', true).' ';
|
||||
$table->data[1][1] .= __('No').' '.print_radio_button_extended ('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, 'enable_profile_options ();', '', true);
|
||||
$table->rowstyle[1] = $config['auth'] != 'mysql' ? '' : 'display: none;';
|
||||
$table->data[2][0] = __('Autocreate profile');
|
||||
$profile_list = get_profiles ();
|
||||
if ($profile_list === false) {
|
||||
$profile_list = array ();
|
||||
}
|
||||
$table->data[2][1] = print_select ($profile_list, 'default_remote_profile', $config['default_remote_profile'], '', '', '', true, false, true, '', $config['autocreate_remote_users'] == 0);
|
||||
$table->data[3][0] = __('Autocreate profile group');
|
||||
$table->data[3][1] = print_select_groups ($config['id_user'], "AR", true, 'default_remote_group', $config['default_remote_group'], '', '', '', true, false, true, '', $config['autocreate_remote_users'] == 0);
|
||||
for ($i = 1; $i <= 3; $i++) {
|
||||
$table->rowstyle[$i] = $config['auth'] != 'mysql' ? '' : 'display: none;';
|
||||
$table->rowclass[$i] = 'remote';
|
||||
}
|
||||
|
||||
$table->data[4][0] = __('LDAP server');
|
||||
$table->data[4][1] = print_input_text ('ldap_server', $config['ldap_server'], '', 30, 100, true);
|
||||
$table->data[5][0] = __('LDAP port');
|
||||
$table->data[5][1] = print_input_text ('ldap_port', $config['ldap_port'], '', 10, 100, true);
|
||||
$table->data[6][0] = __('LDAP version');
|
||||
$ldap_versions = array (1 => 'LDAPv1', 2 => 'LDAPv2', 3 => 'LDAPv3');
|
||||
$table->data[6][1] = print_select ($ldap_versions, 'ldap_version', $config['ldap_version'], '', '', 0, true);
|
||||
$table->data[7][0] = __('Start TLS');
|
||||
$table->data[7][1] = __('Yes').' '.print_radio_button ('ldap_start_tls', 1, '', $config['ldap_start_tls'], true).' ';
|
||||
$table->data[7][1] .= __('No').' '.print_radio_button ('ldap_start_tls', 0, '', $config['ldap_start_tls'], true);
|
||||
$table->data[8][0] = __('Base DN');
|
||||
$table->data[8][1] = print_input_text ('ldap_base_dn', $config['ldap_base_dn'], '', 60, 100, true);
|
||||
$table->data[9][0] = __('Login attribute');
|
||||
$table->data[9][1] = print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true);
|
||||
|
||||
// Hide LDAP configuration options
|
||||
for ($i = 4; $i <= 9; $i++) {
|
||||
$table->rowstyle[$i] = $config['auth'] == 'ldap' ? '' : 'display: none;';
|
||||
$table->rowclass[$i] = 'ldap';
|
||||
}
|
||||
|
||||
// Add enterprise authentication options
|
||||
enterprise_hook ('add_enterprise_auth_options', array (&$table, 10));
|
||||
|
||||
echo '<form id="form_setup" method="post">';
|
||||
print_input_hidden ('update_config', 1);
|
||||
print_table ($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function show_selected_rows () {
|
||||
var auth_method = $("#auth").val ();
|
||||
|
||||
$(".remote").css("display", "none");
|
||||
$(".ldap").css("display", "none");
|
||||
$(".ad").css("display", "none");
|
||||
$(".pandora").css("display", "none");
|
||||
$(".babel").css("display", "none");
|
||||
|
||||
if (auth_method != "mysql") {
|
||||
$(".remote").css("display", "");
|
||||
}
|
||||
$("." + auth_method).css('display', '');
|
||||
|
||||
}
|
||||
|
||||
function enable_profile_options () {
|
||||
var remote_auto = $("input:radio[name=autocreate_remote_users]:checked").val();
|
||||
|
||||
if (remote_auto == 0) {
|
||||
$("#default_remote_profile").attr("disabled", true);
|
||||
$("#default_remote_group").attr("disabled", true);
|
||||
} else {
|
||||
$("#default_remote_profile").attr("disabled", false);
|
||||
$("#default_remote_group").attr("disabled", false);
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue