Merge branch '147-sincronizacion-usuarios-metaconsola' into 'pandora_6.0'

Add select profile, group and tags when autocreate user in few options.

See merge request !44
This commit is contained in:
vgilc 2017-01-23 16:09:30 +01:00
commit 2c920d67a5
2 changed files with 37 additions and 5 deletions

View File

@ -58,6 +58,10 @@ if (is_ajax ()) {
$row['control'] = __('Yes').' '.html_print_radio_button_extended('autocreate_remote_users', 1, '', $config['autocreate_remote_users'], false, '', '', true).'  ';
$row['control'] .= __('No').' '.html_print_radio_button_extended('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, '', '', true);
$table->data['autocreate_remote_users'] = $row;
if (enterprise_installed()) {
add_enterprise_auth_autocreate_profiles($table, $type_auth);
}
}
switch ($type_auth) {
@ -202,7 +206,6 @@ echo '</form>';
<script type="text/javascript">
$('#auth').on('change', function(){
console.log('poco a poco');
type_auth = $('#auth').val();
$.ajax({
type: "POST",

View File

@ -268,8 +268,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
return false;
}
// Create the user in the local database
if (isset($config['ad_advanced_config']) && $config['ad_advanced_config']) {
if ($config["auth"] === 'ad' && (isset($config['ad_advanced_config']) && $config['ad_advanced_config'])) {
if ( defined('METACONSOLE') ) {
@ -314,10 +313,40 @@ function process_user_login_remote ($login, $pass, $api = false) {
return false;
}
//TODO: Check the creation in the nodes
profile_create_user_profile ($login, $config['default_remote_profile'],
$config['default_remote_group'], false, $config['default_assign_tags']);
//TODO: Check the creation in the nodes
if ( is_metaconsole() ) {
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once ('meta/include/functions_groups_meta.php');
$return = groups_meta_synchronizing();
if ($return["group_create_err"] > 0 || $return["group_update_err"] > 0) {
$config["auth_error"] = __('Fail the group synchronizing');
return false;
}
$return = meta_tags_synchronizing();
if ($return['tag_create_err'] > 0 || $return['tag_update_err'] > 0) {
$config["auth_error"] = __('Fail the tag synchronizing');
return false;
}
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR ) {
if (create_user ($login, $pass,
array ('fullname' => $login,
'comments' => 'Imported from ' . $config['auth'])
) === false)
continue;
profile_create_user_profile ($login, $config['default_remote_profile'],
$config['default_remote_group'], false, $config['default_assign_tags']);
}
metaconsole_restore_db();
}
}
}
return $login;