restauro api

Former-commit-id: de9d1588e0e8ef53b48b72d52597963b59aee11f
This commit is contained in:
marcos.alconada 2019-04-23 15:37:54 +02:00
parent 4f25c89a74
commit 58d2abbdae
1 changed files with 4 additions and 91 deletions

View File

@ -37,12 +37,9 @@ $api_password = get_parameter('apipass', '');
$password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
$user_db = get_parameter('user_db', '');
$other = parseOtherParameter($otherSerialize, $otherMode);
$group_db = get_parameter('group_db', '');
$disable = get_parameter('disable', '');
$id_up = get_parameter('id_up', '');
$id_profile = get_parameter('id_profile', '');
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
$correctLogin = false;
@ -110,6 +107,7 @@ if ($correctLogin) {
if ($op == 'set' && $id) {
switch ($op2) {
case 'update_agent':
case 'add_module_in_conf':
case 'update_module_in_conf':
case 'delete_module_in_conf':
@ -151,93 +149,8 @@ if ($correctLogin) {
}
break;
case 'info_user_name':
if ($user_db === '') {
returnError(__('User not specified'), __('User not specified'));
return;
}
$id_os = api_set_info_user_name($returnType, $user_db);
if ($id_os != 100) {
return;
}
if ($id_os == 100) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case 'filter_user_group':
if ($user_db === '' && ( $group_db === '' || $disable === '')) {
returnError(__('User, group or disabled status not specified'), __('User, group or disabled status not specified'));
return;
}
$id_os = api_set_filter_user_group($returnType, $user_db, $group_db, $disable);
if ($id_os != 100) {
return;
}
if ($id_os == false) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case 'delete_user_profiles':
if ($user_db === '') {
returnError(__('User or group not specified'), __('User, group not specified'));
return;
}
$id_os = api_set_delete_user_profiles($user_db, $id_up);
if ($id_os != 100) {
return;
}
if ($id_os == false) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case 'list_all_user':
$id_os = api_set_list_all_user($returnType);
if ($id_os === false) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case 'add_permission_user_to_group':
if ($user_db == null || $group_db == null || $id_up == null) {
returnError(__('User, group or profile not specified'), __('User, group or profile status not specified'));
return;
}
$id_os = api_set_add_permission_user_to_group($returnType, $user_db, $group_db, $id_up, $id_profile);
if ($id_os != 100) {
return;
}
if ($id_os == false) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
default:
// break;
}
}