Merge branch 'ent-fix-improve-cli-profile' into 'develop'
Fixed and improved profile related CLIs. See merge request artica/pandorafms!4029
This commit is contained in:
commit
daf44e6a42
|
@ -193,6 +193,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_profile', '<user_name> <profile_name> <group_name>', 'Delete perfil from user');
|
||||
help_screen_line('--add_profile_to_user', '<user_id> <profile_name> [<group_name>]', 'Add a profile in group to a user');
|
||||
help_screen_line('--create_profile', "<profile_name> <incident_view> <incident_edit> <incident_management> <agent_view>\n\t <agent_edit> <agent_disable> <alert_edit> <alert_management> <user_management> <db_management>\n\t <event_view> <event_edit> <event_management> <report_view> <report_edit> <report_management>\n\t <map_view> <map_edit> <map_management> <vconsole_view> <vconsole_edit> <vconsole_management>\n\t <pandora_management>", 'Create profile');
|
||||
help_screen_line('--update_profile', "<profile_name> <incident_view> <incident_edit> <incident_management> <agent_view>\n\t <agent_edit> <agent_disable> <alert_edit> <alert_management> <user_management> <db_management>\n\t <event_view> <event_edit> <event_management> <report_view> <report_edit> <report_management>\n\t <map_view> <map_edit> <map_management> <vconsole_view> <vconsole_edit> <vconsole_management>\n\t <pandora_management>", 'Modify profile');
|
||||
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');
|
||||
|
@ -568,13 +569,29 @@ sub pandora_create_profile ($$$$$$$$$$$$$$$$$$$$$$$$$) {
|
|||
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
|
||||
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management) = @_;
|
||||
|
||||
return db_insert ($dbh, 'id_up', 'INSERT INTO tperfil (name,incident_edit,incident_view,incident_management,agent_view,agent_edit,alert_edit,user_management,db_management,alert_management,pandora_management,report_view,report_edit,report_management,event_view,event_edit,event_management,agent_disable,map_view,map_edit,map_management,vconsole_view,vconsole_edit,vconsole_management) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);',
|
||||
$profile_name, $incident_view,$incident_edit, $incident_management, $agent_view,
|
||||
return db_insert ($dbh, 'id_up', 'INSERT INTO tperfil (name,incident_view,incident_edit,incident_management,agent_view,agent_edit,agent_disable,alert_edit,alert_management,user_management,db_management,event_view,event_edit,event_management,report_view,report_edit,report_management,map_view,map_edit,map_management,vconsole_view,vconsole_edit,vconsole_management,pandora_management) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);',
|
||||
safe_input($profile_name), $incident_view,$incident_edit, $incident_management, $agent_view,
|
||||
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
|
||||
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
|
||||
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
#### Update profile.
|
||||
###########################################################################
|
||||
sub pandora_update_profile ($$$$$$$$$$$$$$$$$$$$$$$$$) {
|
||||
my ($dbh, $profile_name, $incident_view,$incident_edit, $incident_management, $agent_view,
|
||||
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
|
||||
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
|
||||
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management) = @_;
|
||||
|
||||
return db_update ($dbh, 'UPDATE tperfil SET incident_view = ?, incident_edit = ?, incident_management = ?, agent_view = ?, agent_edit = ?, agent_disable = ?, alert_edit = ?, alert_management = ?, user_management = ?, db_management = ?, event_view = ?, event_edit = ?, event_management = ?, report_view = ?, report_edit = ?, report_management = ?, map_view = ?, map_edit = ?, map_management = ?, vconsole_view = ?, vconsole_edit = ?, vconsole_management = ?, pandora_management = ? WHERE name=?;',
|
||||
$incident_view,$incident_edit, $incident_management, $agent_view,
|
||||
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
|
||||
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
|
||||
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management, safe_input($profile_name));
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Delete a profile from the given user/group.
|
||||
##########################################################################
|
||||
|
@ -4005,6 +4022,26 @@ sub cli_create_profile() {
|
|||
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
## Update profile.
|
||||
## Related option: --update_profile
|
||||
##############################################################################
|
||||
#
|
||||
sub cli_update_profile() {
|
||||
my ($profile_name,$incident_view,$incident_edit,$incident_management,$agent_view,
|
||||
$agent_edit,$agent_disable,$alert_edit,$alert_management,$user_management,$db_management,
|
||||
$event_view,$event_edit,$event_management,$report_view,$report_edit,$report_management,
|
||||
$map_view,$map_edit,$map_management,$vconsole_view,$vconsole_edit,$vconsole_management,$pandora_management) = @ARGV[2..25];
|
||||
|
||||
my $id_profile = get_profile_id($dbh,$profile_name);
|
||||
exist_check($id_profile,'profile',$profile_name);
|
||||
|
||||
pandora_update_profile ($dbh, $profile_name, $incident_view, $incident_edit, $incident_management, $agent_view,
|
||||
$agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management,
|
||||
$event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management,
|
||||
$map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Delete profile.
|
||||
# Related option: --delete_profile
|
||||
|
@ -7432,6 +7469,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 24);
|
||||
cli_create_profile();
|
||||
}
|
||||
elsif ($param eq '--update_profile') {
|
||||
param_check($ltotal, 24);
|
||||
cli_update_profile();
|
||||
}
|
||||
elsif ($param eq '--delete_profile') {
|
||||
param_check($ltotal, 3);
|
||||
cli_delete_profile();
|
||||
|
|
Loading…
Reference in New Issue