Merge branch 'ent-2523-APIListar,-crear,-borrar-y-modificar-Usuarios-desde-la-API-#6167-EUComm' into 'develop'
Ent 2523 api listar, crear, borrar y modificar usuarios desde la api #6167 eu comm See merge request artica/pandorafms!2149 Former-commit-id: a5a1e6aadf4efe43160eebe883a27ce58ac09bc2
This commit is contained in:
commit
ae190ef058
|
@ -7036,9 +7036,9 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
|
|||
function api_set_new_user($id, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
// if (defined ('METACONSOLE')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if(!check_acl($config['id_user'], 0, "UM")) {
|
||||
returnError('forbidden', 'string');
|
||||
|
@ -7055,6 +7055,10 @@ function api_set_new_user($id, $thrash2, $other, $thrash3) {
|
|||
$values['phone'] = $other['data'][6];
|
||||
$values['language'] = $other['data'][7];
|
||||
$values['comments'] = $other['data'][8];
|
||||
$values['time_autorefresh'] = $other['data'][9];
|
||||
$values['default_event_filter'] = $other['data'][10];
|
||||
$values['section'] = $other['data'][11];
|
||||
$values['session_time'] = $other['data'][12];
|
||||
|
||||
if (!create_user ($id, $password, $values))
|
||||
returnError('error_create_user', 'Error create user');
|
||||
|
@ -7098,7 +7102,12 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) {
|
|||
'language',
|
||||
'comments',
|
||||
'is_admin',
|
||||
'block_size'
|
||||
'block_size',
|
||||
'flash_chart',
|
||||
'time_autorefresh',
|
||||
'default_event_filter',
|
||||
'section',
|
||||
'session_time'
|
||||
);
|
||||
|
||||
if ($id == "") {
|
||||
|
@ -8809,9 +8818,9 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db = nul
|
|||
function api_set_delete_user($id, $thrash1, $thrash2, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
// if (defined ('METACONSOLE')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "UM")) {
|
||||
returnError('forbidden', 'string');
|
||||
|
@ -12883,4 +12892,29 @@ function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
|
|||
}
|
||||
}
|
||||
|
||||
function api_get_users($thrash1, $thrash2, $other, $returnType) {
|
||||
|
||||
global $config;
|
||||
|
||||
$user_info = get_users();
|
||||
|
||||
if (!isset($returnType) || empty($returnType) || $returnType == '') {
|
||||
$returnType = "json";
|
||||
$data['data'] = "json";
|
||||
}
|
||||
|
||||
if (!isset($separator) || empty($separator) || $separator == '') {
|
||||
$separator = ";";
|
||||
}
|
||||
|
||||
$data['data'] = $user_info;
|
||||
|
||||
if (count($data) > 0 and $data !== false) {
|
||||
returnData($returnType, $data, $separator);
|
||||
}
|
||||
else {
|
||||
returnError('error_users', 'No users retrieved.');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -187,6 +187,7 @@ sub help_screen{
|
|||
help_screen_line('--disable_eacl', '', 'Disable enterprise ACL system');
|
||||
help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system');
|
||||
help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user');
|
||||
help_screen_line('--meta_synch_user', "<user_name1,user_name2..> <server_name> [<profile_mode> <group_name>\n\t <profile1,profile2..> <create_groups>]", 'Synchronize metaconsole users');
|
||||
print "\nEVENTS:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <critical_instructions> <warning_instructions> <unknown_instructions> \n\t <custom_data_json> <force_create_agent>]", 'Add event');
|
||||
help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name>", 'Validate events');
|
||||
|
@ -4541,6 +4542,18 @@ sub cli_disable_double_auth () {
|
|||
exit;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Synchronize metaconsole users
|
||||
# Related option: --meta_synch_user
|
||||
###############################################################################
|
||||
sub cli_meta_synch_user() {
|
||||
my ($user_name,$server_name,$profile_mode,$group,$profiles,$create_groups) = @ARGV[2..7];
|
||||
|
||||
my $result = api_call(\%conf,'set', 'meta_synch_user', undef, undef, "$user_name|$server_name|$profile_mode|$group|$profiles|$create_groups");
|
||||
print "$result \n\n ";
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Enable user
|
||||
# Related option: --enable_user
|
||||
|
@ -5792,6 +5805,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 1);
|
||||
cli_disable_double_auth();
|
||||
}
|
||||
elsif ($param eq '--meta_synch_user') {
|
||||
param_check($ltotal, 6, 4);
|
||||
cli_meta_synch_user();
|
||||
}
|
||||
elsif ($param eq '--disable_group') {
|
||||
param_check($ltotal, 1);
|
||||
cli_disable_group();
|
||||
|
|
Loading…
Reference in New Issue