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
|
||||
|
||||
|
||||
|
||||
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/assets/
|
||||
|
||||
@@ -38,8 +38,7 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Elytron secrity used for username/password login -->
|
||||
<dependency>
|
||||
<groupId>org.wildfly.security</groupId>
|
||||
@@ -54,7 +53,7 @@
|
||||
<version>2.5.2.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- JWT Library -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
|
||||
@@ -116,7 +116,7 @@ public class CustomerPictureService extends AbstractService {
|
||||
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);
|
||||
List<Customer> customers = typedQuery.getResultList();
|
||||
|
||||
@@ -52,12 +52,12 @@ public class CustomerPictureResource {
|
||||
@Operation(summary = "Add Customer Image to database")
|
||||
@ApiResponse(responseCode = "200", description = "Add successfull")
|
||||
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()) {
|
||||
LOG.debug("identity empty login invalid");
|
||||
return Response.status(Status.UNAUTHORIZED).build();
|
||||
}
|
||||
|
||||
*/
|
||||
boolean success = customerPictureService.addCustomerPicture(customerPictureValue);
|
||||
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(5, pictureCount());
|
||||
|
||||
String authorization = getBasicHeader();
|
||||
LOG.info("authorization: " + authorization);
|
||||
//String authorization = getBasicHeader();
|
||||
//LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH;
|
||||
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);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
@@ -102,6 +102,7 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
System.out.println(text);
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doAddCustomerPictureNoAuth() throws IOException {
|
||||
@@ -115,7 +116,7 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(401, code);
|
||||
}
|
||||
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
var test = new CustomerPictureResourceTest();
|
||||
|
||||
@@ -63,7 +63,17 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
}
|
||||
if (snapshot.hasData) {
|
||||
CustomerDto? dto = snapshot.data;
|
||||
|
||||
if (dto == null) {
|
||||
return Text(
|
||||
AppLocalizations.of(context)!.customerWidgetNotFound,
|
||||
style: TextStyle(
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: _generalStyle.secondaryWidgetBackgroundColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
return _mainWidget(dto);
|
||||
} else if (snapshot.hasError) {
|
||||
var error = snapshot.error;
|
||||
@@ -74,19 +84,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _mainWidget(CustomerDto? dto) {
|
||||
if (dto == null) {
|
||||
return Text(
|
||||
AppLocalizations.of(context)!.customerWidgetNotFound,
|
||||
style: TextStyle(
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: _generalStyle.secondaryWidgetBackgroundColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _mainWidget(CustomerDto dto) {
|
||||
var subText = AppLocalizations.of(context)!.customerWidgetCustomerNumberPrefix(dto.customerNumber);
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -97,7 +95,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
_downloadButton(context),
|
||||
_downloadButton(context, dto),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
@@ -263,7 +261,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
Icons.file_download_outlined,
|
||||
color: _generalStyle.loginFormTextLabelColor,
|
||||
),
|
||||
onPressed: () => _actionDelete(context, customerDto, pictureDto),
|
||||
onPressed: () => _actionDownload(context, customerDto, pictureDto),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
@@ -283,10 +281,10 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _downloadButton(BuildContext context) {
|
||||
Widget _downloadButton(BuildContext context, CustomerDto customerDto) {
|
||||
return ElevatedButton.icon(
|
||||
key: Key("download_all_button"),
|
||||
onPressed: () => _actionDownload(context),
|
||||
onPressed: () => _actionDownload(context, customerDto, null),
|
||||
iconAlignment: IconAlignment.end,
|
||||
icon: Icon(
|
||||
Icons.file_download_outlined,
|
||||
@@ -328,14 +326,14 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
}
|
||||
|
||||
Future<void> _actionSelect(BuildContext context, CustomerDto customerDto, PictureDto pictureDto) async {
|
||||
String uri = "${GlobalRouter.pathHome}${GlobalRouter.pathCustomer}/${customerDto.id}${GlobalRouter.pathPicture}/${pictureDto.id}";
|
||||
String uri = "${GlobalRouter.pathHome}${GlobalRouter.pathCustomer}/${customerDto.id}${GlobalRouter.pathPicture}/${pictureDto.id}";
|
||||
context.go(uri);
|
||||
setState(() {
|
||||
_dto = _customerController.get(id: widget.customerId);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _actionDownload(BuildContext context) async {
|
||||
Future<void> _actionDownload(BuildContext context, CustomerDto customerDto, PictureDto? pictureDto) async {
|
||||
// FIXME: implement a download from the export
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user