removed auth from picture upload
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -59,7 +59,7 @@ hartmann-foto-documentation-frontend/pubspec.lock
|
|||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
|
||||||
|
|
||||||
|
hartmann-foto-documentation-docker/src/main/docker/hartmann-foto-documentation-web-*.war
|
||||||
hartmann-foto-documentation-docker/src/main/docker/hartmann-foto-documentation-web-*.war
|
hartmann-foto-documentation-docker/src/main/docker/hartmann-foto-documentation-web-*.war
|
||||||
hartmann-foto-documentation-web/src/main/webapp/.last_build_id
|
hartmann-foto-documentation-web/src/main/webapp/.last_build_id
|
||||||
hartmann-foto-documentation-web/src/main/webapp/assets/
|
hartmann-foto-documentation-web/src/main/webapp/assets/
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Elytron secrity used for username/password login -->
|
<!-- Elytron secrity used for username/password login -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wildfly.security</groupId>
|
<groupId>org.wildfly.security</groupId>
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class CustomerPictureService extends AbstractService {
|
|||||||
criteriaQuery = criteriaQuery.where(builder.and(predicates.toArray(new Predicate[0])));
|
criteriaQuery = criteriaQuery.where(builder.and(predicates.toArray(new Predicate[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
//criteriaQuery = criteriaQuery.orderBy(builder.asc(builder.lower(customerRoot.get("name")))); FIXME: this causes errors
|
//criteriaQuery = criteriaQuery.orderBy(builder.asc(builder.lower(customerRoot.get("name")))); //FIXME: this causes errors
|
||||||
|
|
||||||
TypedQuery<Customer> typedQuery = entityManager.createQuery(criteriaQuery);
|
TypedQuery<Customer> typedQuery = entityManager.createQuery(criteriaQuery);
|
||||||
List<Customer> customers = typedQuery.getResultList();
|
List<Customer> customers = typedQuery.getResultList();
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public class CustomerPictureResource {
|
|||||||
@Operation(summary = "Add Customer Image to database")
|
@Operation(summary = "Add Customer Image to database")
|
||||||
@ApiResponse(responseCode = "200", description = "Add successfull")
|
@ApiResponse(responseCode = "200", description = "Add successfull")
|
||||||
public Response doAddCustomerPicture(@Context HttpServletRequest httpServletRequest, @JsonSchemaValidate("schema/customer_picture_add.json") CustomerPictureValue customerPictureValue) {
|
public Response doAddCustomerPicture(@Context HttpServletRequest httpServletRequest, @JsonSchemaValidate("schema/customer_picture_add.json") CustomerPictureValue customerPictureValue) {
|
||||||
Optional<SecurityIdentity> identity = loginUtils.authenticate(httpServletRequest);
|
/*Optional<SecurityIdentity> identity = loginUtils.authenticate(httpServletRequest);
|
||||||
if (identity.isEmpty()) {
|
if (identity.isEmpty()) {
|
||||||
LOG.debug("identity empty login invalid");
|
LOG.debug("identity empty login invalid");
|
||||||
return Response.status(Status.UNAUTHORIZED).build();
|
return Response.status(Status.UNAUTHORIZED).build();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
boolean success = customerPictureService.addCustomerPicture(customerPictureValue);
|
boolean success = customerPictureService.addCustomerPicture(customerPictureValue);
|
||||||
return success ? Response.ok().build() : Response.status(Status.BAD_REQUEST).build();
|
return success ? Response.ok().build() : Response.status(Status.BAD_REQUEST).build();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -44,11 +44,11 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
|||||||
assertEquals(3, customerCount());
|
assertEquals(3, customerCount());
|
||||||
assertEquals(5, pictureCount());
|
assertEquals(5, pictureCount());
|
||||||
|
|
||||||
String authorization = getBasicHeader();
|
//String authorization = getBasicHeader();
|
||||||
LOG.info("authorization: " + authorization);
|
//LOG.info("authorization: " + authorization);
|
||||||
String path = deploymentURL + PATH;
|
String path = deploymentURL + PATH;
|
||||||
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||||
.addHeader("Authorization", authorization)
|
//.addHeader("Authorization", authorization)
|
||||||
.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
|
.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
|
||||||
|
|
||||||
HttpResponse httpResponse = executeRequest(request);
|
HttpResponse httpResponse = executeRequest(request);
|
||||||
@@ -102,6 +102,7 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
|||||||
System.out.println(text);
|
System.out.println(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
public void doAddCustomerPictureNoAuth() throws IOException {
|
public void doAddCustomerPictureNoAuth() throws IOException {
|
||||||
@@ -115,7 +116,7 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
|||||||
int code = httpResponse.getStatusLine().getStatusCode();
|
int code = httpResponse.getStatusLine().getStatusCode();
|
||||||
assertEquals(401, code);
|
assertEquals(401, code);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
|
||||||
var test = new CustomerPictureResourceTest();
|
var test = new CustomerPictureResourceTest();
|
||||||
|
|||||||
@@ -63,18 +63,6 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
|||||||
}
|
}
|
||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
CustomerDto? dto = snapshot.data;
|
CustomerDto? dto = snapshot.data;
|
||||||
|
|
||||||
return _mainWidget(dto);
|
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
var error = snapshot.error;
|
|
||||||
return (error is ServerError) ? GeneralErrorWidget.fromServerError(error) : GeneralErrorWidget(error: snapshot.error.toString());
|
|
||||||
}
|
|
||||||
return const WaitingWidget();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _mainWidget(CustomerDto? dto) {
|
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
return Text(
|
return Text(
|
||||||
AppLocalizations.of(context)!.customerWidgetNotFound,
|
AppLocalizations.of(context)!.customerWidgetNotFound,
|
||||||
@@ -86,7 +74,17 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return _mainWidget(dto);
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
var error = snapshot.error;
|
||||||
|
return (error is ServerError) ? GeneralErrorWidget.fromServerError(error) : GeneralErrorWidget(error: snapshot.error.toString());
|
||||||
|
}
|
||||||
|
return const WaitingWidget();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _mainWidget(CustomerDto dto) {
|
||||||
var subText = AppLocalizations.of(context)!.customerWidgetCustomerNumberPrefix(dto.customerNumber);
|
var subText = AppLocalizations.of(context)!.customerWidgetCustomerNumberPrefix(dto.customerNumber);
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -97,7 +95,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
_downloadButton(context),
|
_downloadButton(context, dto),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
@@ -263,7 +261,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
|||||||
Icons.file_download_outlined,
|
Icons.file_download_outlined,
|
||||||
color: _generalStyle.loginFormTextLabelColor,
|
color: _generalStyle.loginFormTextLabelColor,
|
||||||
),
|
),
|
||||||
onPressed: () => _actionDelete(context, customerDto, pictureDto),
|
onPressed: () => _actionDownload(context, customerDto, pictureDto),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -283,10 +281,10 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _downloadButton(BuildContext context) {
|
Widget _downloadButton(BuildContext context, CustomerDto customerDto) {
|
||||||
return ElevatedButton.icon(
|
return ElevatedButton.icon(
|
||||||
key: Key("download_all_button"),
|
key: Key("download_all_button"),
|
||||||
onPressed: () => _actionDownload(context),
|
onPressed: () => _actionDownload(context, customerDto, null),
|
||||||
iconAlignment: IconAlignment.end,
|
iconAlignment: IconAlignment.end,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.file_download_outlined,
|
Icons.file_download_outlined,
|
||||||
@@ -335,7 +333,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _actionDownload(BuildContext context) async {
|
Future<void> _actionDownload(BuildContext context, CustomerDto customerDto, PictureDto? pictureDto) async {
|
||||||
// FIXME: implement a download from the export
|
// FIXME: implement a download from the export
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user