diff --git a/README.md b/README.md index 29b1b9e..8b79efe 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ https://letsencrypt.org/getting-started/ # TODO -- Server: SSL und logs konfigurieren +- Server: logs konfigurieren - Transaktionen mit Passwort-Management ausstatten, Usermanagement korrekt aufsetzen und Rollen durchreichen (derzeit noch inMemoryAuthentication) - http://kielczewski.eu/2014/12/spring-boot-security-application/ - http://spr.com/part-5-integrating-spring-security-with-spring-boot-web/ diff --git a/pom.xml b/pom.xml index 1572987..a8156db 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.tilman next-transactions - 1.2.1 + 1.3.0 org.springframework.boot diff --git a/src/main/java/de/tilman/transactions/Application.java b/src/main/java/de/tilman/transactions/Application.java index c4657a9..62317cd 100644 --- a/src/main/java/de/tilman/transactions/Application.java +++ b/src/main/java/de/tilman/transactions/Application.java @@ -1,7 +1,10 @@ package de.tilman.transactions; +import org.h2.server.web.WebServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.embedded.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; @SpringBootApplication public class Application { diff --git a/src/main/java/de/tilman/transactions/SecurityConfiguration.java b/src/main/java/de/tilman/transactions/SecurityConfiguration.java index 8a5f07a..a24373c 100644 --- a/src/main/java/de/tilman/transactions/SecurityConfiguration.java +++ b/src/main/java/de/tilman/transactions/SecurityConfiguration.java @@ -11,7 +11,6 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.header.HeaderWriter; -import org.springframework.security.web.header.writers.CacheControlHeadersWriter; @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) @@ -28,29 +27,32 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { protected void configure(HttpSecurity http) throws Exception { // Basis-Schutz: Nur autorisierte Zugriffe (feingranulare Steuerung über Assertions) http.authorizeRequests().antMatchers(HttpMethod.GET, "/public/**").permitAll() - // .antMatchers("/console/**").permitAll() // H2 console for the dev database - .anyRequest().authenticated(); +// .antMatchers("/console/**").permitAll() // H2 console for the dev database + .anyRequest().authenticated(); http.formLogin(); http.csrf().disable(); // XXX später wieder aktivieren - // http.headers().frameOptions().disable(); // for H2 console +// http.headers().frameOptions().disable(); // for H2 console // configure caching http.headers().cacheControl().disable(); http.headers().addHeaderWriter(new HeaderWriter() { - CacheControlHeadersWriter originalWriter = new CacheControlHeadersWriter(); + // for dev +// CacheControlHeadersWriter originalWriter = new CacheControlHeadersWriter(); @Override public void writeHeaders(HttpServletRequest request, HttpServletResponse response) { String requestUri = request.getRequestURI(); - if (!requestUri.startsWith("/public")) { - originalWriter.writeHeaders(request, response); - } else { + if (requestUri.startsWith("/public")) { response.setHeader("Cache-Control", "public, max-age=10000000"); } + else { + response.setHeader("Cache-Control", "public, max-age=600000"); +// originalWriter.writeHeaders(request, response); + } } }); } diff --git a/src/main/resources/static/js/controllers.js b/src/main/resources/static/js/controllers.js index bca161d..024fe77 100644 --- a/src/main/resources/static/js/controllers.js +++ b/src/main/resources/static/js/controllers.js @@ -402,14 +402,14 @@ transactionControllers.controller('ImportCtrl', [ '$scope', '$resource', '$locat }); // XXX - $scope.csvInput = "\"08.07.2016\";\"08.07.2016\";\"Übertrag/Überweisung\";\"Empfänger: Tilman Liero Kto/IBAN: DE44200411330649163305 BLZ/BIC: COBADEHD001 Buchungstext: none End-to-End-Ref.: nicht angegeben Ref. JK21619010302362/2\";\"-40,00\";\n\"27.06.2016\";\"27.06.2016\";\"Lastschrift/Belast.\";\"Auftraggeber: DANKE, IHR LIDL Kto/IBAN: DE61300500000008000119 Buchungstext: Kartenzahlung DANKE, IHR LIDL//Berlin/DE 2016-06-25T09:47:08 KFN 2 VJ 1912 Ref. 6GL16179A2640086/6763\";\"-70,17\";\n\"24.06.2016\";\"24.06.2016\";\"Übertrag/Überweisung\";\"Auftraggeber: Tilman Liero Buchungstext: Uebertrag comdirect bank End-to-End-Ref.: nicht angegeben Ref. IX216176F0205292/1\";\"200,00\";\n\"24.06.2016\";\"24.06.2016\";\"Übertrag/Überweisung\";\"Auftraggeber: Wohnungsbau-Verein Neukölln eG Buchungstext: Mg.-Nr. 35823, Walther, Tilman - 4, Dividende 2015 End-to-End-Ref.: nicht angegeben Ref. H221617674648332/35629\";\"4,42\";"; + $scope.csvInput = "\"30.07.2016\";\"30.07.2016\";\"Übertrag/Überweisung\";\"Empfänger: Tilman Liero Kto/IBAN: DE44200411330649163305 BLZ/BIC: COBADEHD001 Buchungstext: none End-to-End-Ref.: nicht angegeben Ref. JK21619010302362/2\";\"-40,00\";\n\"29.07.2016\";\"29.07.2016\";\"Lastschrift/Belast.\";\"Auftraggeber: DANKE, IHR LIDL Kto/IBAN: DE61300500000008000119 Buchungstext: Kartenzahlung DANKE, IHR LIDL//Berlin/DE 2016-06-25T09:47:08 KFN 2 VJ 1912 Ref. 6GL16179A2640086/6763\";\"-70,17\";\n\"28.07.2016\";\"28.07.2016\";\"Übertrag/Überweisung\";\"Auftraggeber: Tilman Liero Buchungstext: Uebertrag comdirect bank End-to-End-Ref.: nicht angegeben Ref. IX216176F0205292/1\";\"200,00\";\n\"28.07.2016\";\"28.07.2016\";\"Übertrag/Überweisung\";\"Auftraggeber: Wohnungsbau-Verein Neukölln eG Buchungstext: Mg.-Nr. 35823, Walther, Tilman - 4, Dividende 2015 End-to-End-Ref.: nicht angegeben Ref. H221617674648332/35629\";\"4,42\";"; } $scope.initPage(); } ]); -transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$location', 'ImportService', function($scope, $resource, $location, ImportService) { +transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$location', 'ImportService', 'Transaction', function($scope, $resource, $location, ImportService, Transaction) { $scope.processCSV = function () { $scope.account = ImportService.getAccount(); @@ -452,10 +452,6 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l } - // XXX - console.log(matcherData); - console.log($scope.matchers); - for (i = 0; i < $scope.csv.length; i++) { var matched = false; var j = 0; @@ -487,5 +483,26 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l }); } + $scope.importTransaction = function(line) { + if (line.targetCategory) { + + var newTransaction = new Transaction({ + "account" : $scope.account._links.self.href, + "amount" : line[4].replace(',', '.'), + "date" : new Date(line[1].substr(6,4), line[1].substr(3,2), line[1].substr(0,2)), + "description" : line.targetDescription, + "category" : line.targetCategory._links.self.href, + "creditor" : "" + }); + + newTransaction.$save(function(transaction) { + line.submitted = true; + console.log(transaction); + line.submittedTransactionLink = transaction._links.self.href; + line.submittedTransactionId = transaction.id; + }); + } + } + } ]); diff --git a/src/main/resources/static/partials/import-list.html b/src/main/resources/static/partials/import-list.html index 810aeef..979d3ef 100644 --- a/src/main/resources/static/partials/import-list.html +++ b/src/main/resources/static/partials/import-list.html @@ -1,20 +1,22 @@
+
Import to

{{account.name}}

+ - - + - - + + + + - @@ -25,11 +27,17 @@ id="categorySelect" ng-model='line.targetCategory' size='1' - ng-options="category.name for category in categories track by category._links.self.href"> + ng-options="category.name for category in categories track by category._links.self.href"> + - + + +
WertstellungWertstellung TypTextBetragTextBetrag Kategorie Notiz Matcher
{{line[1]}} {{line[2]}} {{line[3]}} {{line.targetDescription}} {{line.matcherPosition}} + + {{line.submittedTransactionId}} +
@@ -46,7 +54,7 @@ Target Description - + {{matcher.position}} {{matcher.dateMatcherCode}} {{matcher.typeMatcherCode}} diff --git a/src/main/resources/static/partials/import.html b/src/main/resources/static/partials/import.html index 3f3fd75..ec6b8c1 100644 --- a/src/main/resources/static/partials/import.html +++ b/src/main/resources/static/partials/import.html @@ -3,14 +3,13 @@
-
+