fix(api): Add back validateDataApplications (#5539)
This commit is contained in:
@@ -3006,73 +3006,73 @@ class ApplicationsController extends Controller
|
|||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// private function validateDataApplications(Request $request, Server $server)
|
private function validateDataApplications(Request $request, Server $server)
|
||||||
// {
|
{
|
||||||
// $teamId = getTeamIdFromToken();
|
$teamId = getTeamIdFromToken();
|
||||||
|
|
||||||
// // Validate ports_mappings
|
// Validate ports_mappings
|
||||||
// if ($request->has('ports_mappings')) {
|
if ($request->has('ports_mappings')) {
|
||||||
// $ports = [];
|
$ports = [];
|
||||||
// foreach (explode(',', $request->ports_mappings) as $portMapping) {
|
foreach (explode(',', $request->ports_mappings) as $portMapping) {
|
||||||
// $port = explode(':', $portMapping);
|
$port = explode(':', $portMapping);
|
||||||
// if (in_array($port[0], $ports)) {
|
if (in_array($port[0], $ports)) {
|
||||||
// return response()->json([
|
return response()->json([
|
||||||
// 'message' => 'Validation failed.',
|
'message' => 'Validation failed.',
|
||||||
// 'errors' => [
|
'errors' => [
|
||||||
// 'ports_mappings' => 'The first number before : should be unique between mappings.',
|
'ports_mappings' => 'The first number before : should be unique between mappings.',
|
||||||
// ],
|
],
|
||||||
// ], 422);
|
], 422);
|
||||||
// }
|
}
|
||||||
// $ports[] = $port[0];
|
$ports[] = $port[0];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// // Validate custom_labels
|
// Validate custom_labels
|
||||||
// if ($request->has('custom_labels')) {
|
if ($request->has('custom_labels')) {
|
||||||
// if (! isBase64Encoded($request->custom_labels)) {
|
if (! isBase64Encoded($request->custom_labels)) {
|
||||||
// return response()->json([
|
return response()->json([
|
||||||
// 'message' => 'Validation failed.',
|
'message' => 'Validation failed.',
|
||||||
// 'errors' => [
|
'errors' => [
|
||||||
// 'custom_labels' => 'The custom_labels should be base64 encoded.',
|
'custom_labels' => 'The custom_labels should be base64 encoded.',
|
||||||
// ],
|
],
|
||||||
// ], 422);
|
], 422);
|
||||||
// }
|
}
|
||||||
// $customLabels = base64_decode($request->custom_labels);
|
$customLabels = base64_decode($request->custom_labels);
|
||||||
// if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
|
if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
|
||||||
// return response()->json([
|
return response()->json([
|
||||||
// 'message' => 'Validation failed.',
|
'message' => 'Validation failed.',
|
||||||
// 'errors' => [
|
'errors' => [
|
||||||
// 'custom_labels' => 'The custom_labels should be base64 encoded.',
|
'custom_labels' => 'The custom_labels should be base64 encoded.',
|
||||||
// ],
|
],
|
||||||
// ], 422);
|
], 422);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if ($request->has('domains') && $server->isProxyShouldRun()) {
|
if ($request->has('domains') && $server->isProxyShouldRun()) {
|
||||||
// $uuid = $request->uuid;
|
$uuid = $request->uuid;
|
||||||
// $fqdn = $request->domains;
|
$fqdn = $request->domains;
|
||||||
// $fqdn = str($fqdn)->replaceEnd(',', '')->trim();
|
$fqdn = str($fqdn)->replaceEnd(',', '')->trim();
|
||||||
// $fqdn = str($fqdn)->replaceStart(',', '')->trim();
|
$fqdn = str($fqdn)->replaceStart(',', '')->trim();
|
||||||
// $errors = [];
|
$errors = [];
|
||||||
// $fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) {
|
$fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) {
|
||||||
// if (filter_var($domain, FILTER_VALIDATE_URL) === false) {
|
if (filter_var($domain, FILTER_VALIDATE_URL) === false) {
|
||||||
// $errors[] = 'Invalid domain: '.$domain;
|
$errors[] = 'Invalid domain: '.$domain;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return str($domain)->trim()->lower();
|
return str($domain)->trim()->lower();
|
||||||
// });
|
});
|
||||||
// if (count($errors) > 0) {
|
if (count($errors) > 0) {
|
||||||
// return response()->json([
|
return response()->json([
|
||||||
// 'message' => 'Validation failed.',
|
'message' => 'Validation failed.',
|
||||||
// 'errors' => $errors,
|
'errors' => $errors,
|
||||||
// ], 422);
|
], 422);
|
||||||
// }
|
}
|
||||||
// if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) {
|
if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) {
|
||||||
// return response()->json([
|
return response()->json([
|
||||||
// 'message' => 'Validation failed.',
|
'message' => 'Validation failed.',
|
||||||
// 'errors' => [
|
'errors' => [
|
||||||
// 'domains' => 'One of the domain is already used.',
|
'domains' => 'One of the domain is already used.',
|
||||||
// ],
|
],
|
||||||
// ], 422);
|
], 422);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user