i have this API action
// Customers live search
$app->get(‘/getallnames’, function ($request, $response, $args) {
$response2 = $response->withJson(ExecuteRows(“SELECT * FROM pos_customer ORDER BY fullname ASC”)); // Select the record by name and return as JSON
return $response2; // Return Psr\Http\Message\ResponseInterface object
});
i want only logged in users and user level with permission to be able to consume the endpoint .