corrected privileges, see #11

This commit is contained in:
Jottyfan 2023-12-27 11:01:46 +01:00
parent 0d476c6f91
commit 8e790a7660
26 changed files with 172 additions and 156 deletions

View File

@ -25,6 +25,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>

View File

@ -0,0 +1,2 @@
boot.validation.initialized=true
eclipse.preferences.version=1

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '3.1.5' id 'org.springframework.boot' version '3.2.1'
id "io.spring.dependency-management" version "1.1.3" id "io.spring.dependency-management" version "1.1.4"
id 'java' id 'java'
id 'war' id 'war'
id 'eclipse' id 'eclipse'
@ -8,7 +8,7 @@ plugins {
} }
group = 'de.jottyfan.camporganizer' group = 'de.jottyfan.camporganizer'
version = '0.6.5' version = '0.6.6'
description = """CampOrganizer2""" description = """CampOrganizer2"""
@ -41,12 +41,12 @@ war {
} }
dependencies { dependencies {
implementation 'org.apache.logging.log4j:log4j-api:2.21.0' implementation 'org.apache.logging.log4j:log4j-api:2.22.0'
implementation 'org.apache.logging.log4j:log4j-core:2.21.0' implementation 'org.apache.logging.log4j:log4j-core:2.22.0'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.21.0' implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.22.0'
implementation 'org.webjars:bootstrap:5.3.2' implementation 'org.webjars:bootstrap:5.3.2'
implementation 'org.webjars:font-awesome:6.4.2' implementation 'org.webjars:font-awesome:6.5.1'
implementation 'org.webjars:jquery:3.7.1' implementation 'org.webjars:jquery:3.7.1'
implementation 'org.webjars:popper.js:2.11.7' implementation 'org.webjars:popper.js:2.11.7'
implementation 'org.webjars:datatables:1.13.5' implementation 'org.webjars:datatables:1.13.5'
@ -55,9 +55,9 @@ dependencies {
implementation 'net.sf.biweekly:biweekly:0.6.7' implementation 'net.sf.biweekly:biweekly:0.6.7'
// for using the keycloak rest interface // for using the keycloak rest interface
implementation 'org.keycloak:keycloak-server-spi:22.0.4' implementation 'org.keycloak:keycloak-server-spi:23.0.3'
implementation 'org.keycloak:keycloak-admin-client:22.0.4' implementation 'org.keycloak:keycloak-admin-client:23.0.3'
implementation 'org.jboss.resteasy:resteasy-client:6.2.5.Final' implementation 'org.jboss.resteasy:resteasy-client:6.2.6.Final'
// backward compatibility until the complete registration is converted to keycloak // backward compatibility until the complete registration is converted to keycloak
implementation 'org.jasypt:jasypt:1.9.3' implementation 'org.jasypt:jasypt:1.9.3'
@ -66,13 +66,13 @@ dependencies {
implementation 'com.rometools:rome:2.1.0' implementation 'com.rometools:rome:2.1.0'
// mail support // mail support
implementation 'commons-validator:commons-validator:1.7' implementation 'commons-validator:commons-validator:1.8.0'
implementation 'org.springframework.boot:spring-boot-starter-mail' implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-jooq' implementation 'org.springframework.boot:spring-boot-starter-jooq'
implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-security'
implementation "org.springframework.boot:spring-boot-starter-oauth2-client" implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
implementation 'org.springframework.security:spring-security-oauth2-authorization-server:1.1.3' implementation 'org.springframework.security:spring-security-oauth2-authorization-server:1.2.1'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-validation'
@ -80,7 +80,7 @@ dependencies {
implementation 'de.jottyfan:COJooq:2023.03' implementation 'de.jottyfan:COJooq:2023.03'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0' implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0'
implementation 'commons-io:commons-io:2.14.0' implementation 'commons-io:commons-io:2.15.1'
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat' runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -74,7 +74,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/document/edit/{id}") @GetMapping("/admin/document/edit/{id}")
public String prepareAddDocument(@PathVariable Integer id, Model model, HttpServletRequest request) { public String prepareAddDocument(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
model.addAttribute("bean", service.getDocument(id)); model.addAttribute("bean", service.getDocument(id));
return "/admin/document_edit"; return "/admin/document_edit";
} }
@ -92,7 +92,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/document/delete/{id}") @GetMapping("/admin/document/delete/{id}")
public String deleteDocument(@PathVariable Integer id, Model model, HttpServletRequest request) { public String deleteDocument(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
service.deleteDocument(id); service.deleteDocument(id);
return "redirect:/admin/document"; return "redirect:/admin/document";
} }
@ -111,7 +111,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/location/edit/{id}") @GetMapping("/admin/location/edit/{id}")
public String prepareAddLocation(@PathVariable Integer id, Model model, HttpServletRequest request) { public String prepareAddLocation(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
model.addAttribute("bean", service.getLocation(id)); model.addAttribute("bean", service.getLocation(id));
model.addAttribute("documents", service.getLocationDocuments()); model.addAttribute("documents", service.getLocationDocuments());
return "/admin/location_edit"; return "/admin/location_edit";
@ -132,7 +132,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/location/delete/{id}") @GetMapping("/admin/location/delete/{id}")
public String deleteLocation(@PathVariable Integer id, Model model, HttpServletRequest request) { public String deleteLocation(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
service.deleteLocation(id); service.deleteLocation(id);
return "redirect:/admin/location"; return "redirect:/admin/location";
} }
@ -154,7 +154,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/camp/edit/{id}") @GetMapping("/admin/camp/edit/{id}")
public String prepareEditCamp(@PathVariable Integer id, Model model, HttpServletRequest request) { public String prepareEditCamp(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
model.addAttribute("bean", service.getCamp(id)); model.addAttribute("bean", service.getCamp(id));
model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("documents", service.getCampDocuments());
model.addAttribute("locations", service.getLocations()); model.addAttribute("locations", service.getLocations());
@ -186,7 +186,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/camp/delete/{id}") @GetMapping("/admin/camp/delete/{id}")
public String deleteCamp(@PathVariable Integer id, Model model, HttpServletRequest request, public String deleteCamp(@PathVariable("id") Integer id, Model model, HttpServletRequest request,
RedirectAttributes redirect) { RedirectAttributes redirect) {
String error = service.deleteCamp(id); String error = service.deleteCamp(id);
redirect.addAttribute("error", error); redirect.addAttribute("error", error);

View File

@ -49,7 +49,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/rolebased/{role}") @GetMapping("/admin/privileges/rolebased/{role}")
public String getRolebased(@PathVariable String role, Model model) { public String getRolebased(@PathVariable("role") String role, Model model) {
model.addAttribute("list", service.getAllModules()); model.addAttribute("list", service.getAllModules());
model.addAttribute("selected", role); model.addAttribute("selected", role);
model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role))); model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role)));
@ -58,7 +58,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/campbased/{campid}") @GetMapping("/admin/privileges/campbased/{campid}")
public String getCampbased(@PathVariable Integer campid, Model model) { public String getCampbased(@PathVariable("campid") Integer campid, Model model) {
List<CampBean> list = service.getAllCamps(); List<CampBean> list = service.getAllCamps();
model.addAttribute("list", list); model.addAttribute("list", list);
String campname = "?"; String campname = "?";
@ -74,7 +74,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/userbased/{userid}") @GetMapping("/admin/privileges/userbased/{userid}")
public String getUserbased(@PathVariable Integer userid, Model model) { public String getUserbased(@PathVariable("userid") Integer userid, Model model) {
List<ProfileBean> list = service.getProfiles(); List<ProfileBean> list = service.getProfiles();
model.addAttribute("list", list); model.addAttribute("list", list);
String selected = "?"; String selected = "?";
@ -90,13 +90,13 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/delete/{id}/{pagedest}") @GetMapping("/admin/privileges/delete/{id}/{pagedest}")
public String deleteFromCampProfile(@PathVariable Integer id, @PathVariable String pagedest) { public String deleteFromCampProfile(@PathVariable("id") Integer id, @PathVariable("pagedest") String pagedest) {
service.deleteFromCampProfile(id); service.deleteFromCampProfile(id);
return "redirect:" + pagedest.replace("_", "/"); return "redirect:" + pagedest.replace("_", "/");
} }
@GetMapping("/admin/privileges/add/{pagedest}") @GetMapping("/admin/privileges/add/{pagedest}")
public String prepareAdd(Model model, @PathVariable String pagedest) { public String prepareAdd(Model model, @PathVariable("pagedest") String pagedest) {
model.addAttribute("pagedest", pagedest); model.addAttribute("pagedest", pagedest);
model.addAttribute("bean", new CampProfileBean()); model.addAttribute("bean", new CampProfileBean());
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
@ -106,7 +106,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@PostMapping("/admin/privileges/insert/{pagedest}") @PostMapping("/admin/privileges/insert/{pagedest}")
public String insertCampProfile(@Valid @ModelAttribute("bean") CampProfileBean bean, final BindingResult bindingResult, @PathVariable String pagedest, Model model) { public String insertCampProfile(@Valid @ModelAttribute("bean") CampProfileBean bean, final BindingResult bindingResult, @PathVariable("pagedest") String pagedest, Model model) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
model.addAttribute("pagedest", pagedest); model.addAttribute("pagedest", pagedest);
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
@ -119,7 +119,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/abortinsert/{pagedest}") @GetMapping("/admin/privileges/abortinsert/{pagedest}")
public String abortInsert(@PathVariable String pagedest) { public String abortInsert(@PathVariable("pagedest") String pagedest) {
return "redirect:" + pagedest.replace("_", "/"); return "redirect:" + pagedest.replace("_", "/");
} }
} }

View File

@ -39,7 +39,7 @@ public class BookingsController extends CommonController {
@GetMapping("/business/bookings/{id}") @GetMapping("/business/bookings/{id}")
@RolesAllowed({"business_booking"}) @RolesAllowed({"business_booking"})
public String getBooking(Model model, @PathVariable Integer id) { public String getBooking(Model model, @PathVariable("id") Integer id) {
BookerBean bean = bookingsService.getBooker(id, getCurrentUser()); BookerBean bean = bookingsService.getBooker(id, getCurrentUser());
model.addAttribute("booker", bean); model.addAttribute("booker", bean);
model.addAttribute("addBean", new AddPaymentBean()); model.addAttribute("addBean", new AddPaymentBean());
@ -48,7 +48,7 @@ public class BookingsController extends CommonController {
@PostMapping("/business/bookings/payment/{id}") @PostMapping("/business/bookings/payment/{id}")
@RolesAllowed({"business_booking"}) @RolesAllowed({"business_booking"})
public String addPayment(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id) { public String addPayment(Model model, @ModelAttribute("bean") AddPaymentBean bean, @PathVariable("id") Integer id) {
Double payment = bean.getPayment(); Double payment = bean.getPayment();
bookingsService.addPayment(id, payment); bookingsService.addPayment(id, payment);
return getBooking(model, id); return getBooking(model, id);
@ -56,7 +56,7 @@ public class BookingsController extends CommonController {
@PostMapping("/business/bookings/listpayment/{id}") @PostMapping("/business/bookings/listpayment/{id}")
@RolesAllowed({"business_booking"}) @RolesAllowed({"business_booking"})
public String addListPayment(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id, @RequestParam(defaultValue = "") String search) { public String addListPayment(Model model, @ModelAttribute("bean") AddPaymentBean bean, @PathVariable("id") Integer id, @RequestParam(defaultValue = "") String search) {
Double payment = bean.getPayment(); Double payment = bean.getPayment();
bookingsService.addPayment(id, payment); bookingsService.addPayment(id, payment);
LOGGER.debug("search is {}", search); LOGGER.debug("search is {}", search);

View File

@ -2,7 +2,7 @@ package de.jottyfan.camporganizer.module.business.bookings;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.EnumConverter; import de.jottyfan.camporganizer.db.EnumConverter;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean; import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean;
@ -55,8 +56,8 @@ public class BookingsRepository {
.select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED, V_CAMP.NAME, V_CAMP.YEAR) .select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED, V_CAMP.NAME, V_CAMP.YEAR)
.from(T_PERSON) .from(T_PERSON)
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)) .where(T_PROFILE.USERNAME.eq(username))
.orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME); .orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME);
// @formatter:on // @formatter:on
@ -108,8 +109,8 @@ public class BookingsRepository {
V_CAMP.PK) V_CAMP.PK)
.from(T_PERSON) .from(T_PERSON)
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)) .where(T_PROFILE.USERNAME.eq(username))
.and(T_PERSON.PK.eq(id)); .and(T_PERSON.PK.eq(id));
// @formatter:on // @formatter:on

View File

@ -4,7 +4,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION; import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP_BUDGET; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP_BUDGET;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
import de.jottyfan.camporganizer.module.business.business.model.BusinessBean; import de.jottyfan.camporganizer.module.business.business.model.BusinessBean;
import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean; import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean;
@ -57,8 +58,8 @@ public class BusinessRepository {
V_CAMP_BUDGET.FK_CAMP) V_CAMP_BUDGET.FK_CAMP)
.from(V_CAMP_BUDGET) .from(V_CAMP_BUDGET)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(V_CAMP_BUDGET.FK_CAMP)) .leftJoin(T_CAMP).on(T_CAMP.PK.eq(V_CAMP_BUDGET.FK_CAMP))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP_BUDGET.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(V_CAMP_BUDGET.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)) .where(T_PROFILE.USERNAME.eq(username))
.orderBy(T_CAMP.ARRIVE); .orderBy(T_CAMP.ARRIVE);
// @formatter:on // @formatter:on
@ -96,8 +97,8 @@ public class BusinessRepository {
.from(T_PERSON) .from(T_PERSON)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
.leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION)) .leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_CAMP.PK)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_CAMP.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)); .where(T_PROFILE.USERNAME.eq(username));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());

View File

@ -22,7 +22,7 @@ public class CampController extends CommonController {
@GetMapping("/business/camp/{id}") @GetMapping("/business/camp/{id}")
@RolesAllowed({ "business" }) @RolesAllowed({ "business" })
public String getCamp(Model model, @PathVariable Integer id) { public String getCamp(Model model, @PathVariable("id") Integer id) {
String username = super.getCurrentUser(); String username = super.getCurrentUser();
model.addAttribute("currentUser", username); model.addAttribute("currentUser", username);
model.addAttribute("campId", id); model.addAttribute("campId", id);

View File

@ -2,7 +2,7 @@ package de.jottyfan.camporganizer.module.business.camp;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.EnumConverter; import de.jottyfan.camporganizer.db.EnumConverter;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.module.business.camp.model.CampBean; import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
import de.jottyfan.camporganizer.module.business.camp.model.PersonBean; import de.jottyfan.camporganizer.module.business.camp.model.PersonBean;
@ -54,8 +55,8 @@ public class CampRepository {
// @formatter:off // @formatter:off
.select(V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.ARRIVE, V_CAMP.DEPART, V_CAMP.LOCATION_NAME, V_CAMP.PRICE) .select(V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.ARRIVE, V_CAMP.DEPART, V_CAMP.LOCATION_NAME, V_CAMP.PRICE)
.from(V_CAMP) .from(V_CAMP)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP.PK)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(V_CAMP.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(V_CAMP.PK.eq(pk)) .where(V_CAMP.PK.eq(pk))
.and(T_PROFILE.USERNAME.eq(username)); .and(T_PROFILE.USERNAME.eq(username));
// @formatter:on // @formatter:on
@ -85,8 +86,8 @@ public class CampRepository {
// @formatter:off // @formatter:off
.select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED) .select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED)
.from(T_PERSON) .from(T_PERSON)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PERSON.FK_CAMP.eq(pk)) .where(T_PERSON.FK_CAMP.eq(pk))
.and(T_PROFILE.USERNAME.eq(username)) .and(T_PROFILE.USERNAME.eq(username))
.orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME); .orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME);

View File

@ -0,0 +1,64 @@
package de.jottyfan.camporganizer.module.business.privileges;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.module.business.privileges.model.BusinessPrivilegesBean;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.annotation.security.RolesAllowed;
import jakarta.validation.Valid;
/**
*
* @author jotty
*
*/
@Controller
public class BusinessPrivilegesController extends CommonController {
@Autowired
private BusinessPrivilegesService service;
@GetMapping("/business/privileges")
@RolesAllowed({ "admin" })
public String getIndex(Model model) {
String username = super.getCurrentUser();
model.addAttribute("currentUser", username);
model.addAttribute("privileges", service.getPrivileges());
model.addAttribute("profiles", service.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
model.addAttribute("bean", new BusinessPrivilegesBean());
return "business/privileges";
}
@PostMapping("/business/privileges/add")
@RolesAllowed({ "admin" })
public String getAdd(@Valid @ModelAttribute("bean") BusinessPrivilegesBean bean, BindingResult br, Model model) {
if (br.hasErrors()) {
String username = super.getCurrentUser();
model.addAttribute("currentUser", username);
model.addAttribute("privileges", service.getPrivileges());
model.addAttribute("profiles", service.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
return "business/privileges";
}
service.add(bean);
return "redirect:/business/privileges";
}
@GetMapping("/business/privileges/delete")
@RolesAllowed({ "admin" })
public String getDelete(@RequestParam("fkCamp") Integer fkCamp, @RequestParam("fkProfile") Integer fkProfile,
Model model) {
BusinessPrivilegesBean bean = new BusinessPrivilegesBean();
bean.setFkCamp(fkCamp);
bean.setFkProfile(fkProfile);
service.remove(bean, super.getCurrentUser());
return "redirect:/business/privileges";
}
}

View File

@ -1,8 +1,8 @@
package de.jottyfan.camporganizer.module.business.privileges; package de.jottyfan.camporganizer.module.business.privileges;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -23,8 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.tables.records.TSalesprofileRecord; import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean; import de.jottyfan.camporganizer.db.jooq.tables.records.TCampprofileRecord;
import de.jottyfan.camporganizer.module.business.privileges.model.BusinessPrivilegesBean;
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean; import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
/** /**
@ -34,25 +35,25 @@ import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
*/ */
@Repository @Repository
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public class PrivilegesRepository { public class BusinessPrivilegesRepository {
private static final Logger LOGGER = LogManager.getLogger(PrivilegesRepository.class); private static final Logger LOGGER = LogManager.getLogger(BusinessPrivilegesRepository.class);
@Autowired @Autowired
private DSLContext jooq; private DSLContext jooq;
public List<PrivilegesBean> getPrivileges() { public List<BusinessPrivilegesBean> getPrivileges() {
SelectSeekStep3<Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double>, LocalDateTime, String, String> sql = jooq SelectSeekStep3<Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double>, LocalDateTime, String, String> sql = jooq
// @formatter:off // @formatter:off
.select(T_PROFILE.FORENAME, T_PROFILE.SURNAME, T_PROFILE.DUEDATE, T_PROFILE.USERNAME, T_PROFILE.PK, V_CAMP.PK, V_CAMP.NAME, V_CAMP.YEAR) .select(T_PROFILE.FORENAME, T_PROFILE.SURNAME, T_PROFILE.DUEDATE, T_PROFILE.USERNAME, T_PROFILE.PK, V_CAMP.PK, V_CAMP.NAME, V_CAMP.YEAR)
.from(V_CAMP) .from(V_CAMP)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP.PK)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(V_CAMP.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.orderBy(V_CAMP.ARRIVE, T_PROFILE.SURNAME, T_PROFILE.FORENAME); .orderBy(V_CAMP.ARRIVE, T_PROFILE.SURNAME, T_PROFILE.FORENAME);
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<PrivilegesBean> list = new ArrayList<>(); List<BusinessPrivilegesBean> list = new ArrayList<>();
for (Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double> r : sql.fetch()) { for (Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double> r : sql.fetch()) {
PrivilegesBean bean = new PrivilegesBean(); BusinessPrivilegesBean bean = new BusinessPrivilegesBean();
bean.setCampName(r.get(V_CAMP.NAME)); bean.setCampName(r.get(V_CAMP.NAME));
bean.setCampYear(r.get(V_CAMP.YEAR)); bean.setCampYear(r.get(V_CAMP.YEAR));
bean.setFkCamp(r.get(V_CAMP.PK)); bean.setFkCamp(r.get(V_CAMP.PK));
@ -93,25 +94,26 @@ public class PrivilegesRepository {
return list; return list;
} }
public Integer add(PrivilegesBean bean) { public Integer add(BusinessPrivilegesBean bean) {
InsertReturningStep<TSalesprofileRecord> sql = jooq InsertReturningStep<TCampprofileRecord> sql = jooq
// @formatter:off // @formatter:off
.insertInto(T_SALESPROFILE, T_SALESPROFILE.FK_CAMP, T_SALESPROFILE.FK_PROFILE) .insertInto(T_CAMPPROFILE, T_CAMPPROFILE.FK_CAMP, T_CAMPPROFILE.FK_PROFILE, T_CAMPPROFILE.MODULE)
.values(bean.getFkCamp(), bean.getFkProfile()) .values(bean.getFkCamp(), bean.getFkProfile(), EnumModule.business)
.onConflict(T_SALESPROFILE.FK_CAMP, T_SALESPROFILE.FK_PROFILE) .onConflict(T_CAMPPROFILE.FK_CAMP, T_CAMPPROFILE.FK_PROFILE, T_CAMPPROFILE.MODULE)
.doNothing(); .doNothing();
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
return sql.execute(); return sql.execute();
} }
public Integer remove(PrivilegesBean bean, String currentUser) { public Integer remove(BusinessPrivilegesBean bean, String currentUser) {
DeleteConditionStep<TSalesprofileRecord> sql = jooq DeleteConditionStep<TCampprofileRecord> sql = jooq
// @formatter:off // @formatter:off
.deleteFrom(T_SALESPROFILE) .deleteFrom(T_CAMPPROFILE)
.where(T_SALESPROFILE.FK_CAMP.eq(bean.getFkCamp())) .where(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.and(T_SALESPROFILE.FK_PROFILE.eq(bean.getFkProfile())) .and(T_CAMPPROFILE.FK_CAMP.eq(bean.getFkCamp()))
.and(T_SALESPROFILE.FK_PROFILE.notIn(jooq .and(T_CAMPPROFILE.FK_PROFILE.eq(bean.getFkProfile()))
.and(T_CAMPPROFILE.FK_PROFILE.notIn(jooq
.select(T_PROFILE.PK) .select(T_PROFILE.PK)
.from(T_PROFILE) .from(T_PROFILE)
.where(T_PROFILE.USERNAME.eq(currentUser)))); .where(T_PROFILE.USERNAME.eq(currentUser))));

View File

@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.module.business.camp.model.CampBean; import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean; import de.jottyfan.camporganizer.module.business.privileges.model.BusinessPrivilegesBean;
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean; import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
/** /**
@ -20,14 +20,14 @@ import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
* *
*/ */
@Service @Service
public class PrivilegesService { public class BusinessPrivilegesService {
@Autowired @Autowired
private PrivilegesRepository gateway; private BusinessPrivilegesRepository gateway;
public Map<Integer, CampBean> getPrivileges() { public Map<Integer, CampBean> getPrivileges() {
List<PrivilegesBean> list = gateway.getPrivileges(); List<BusinessPrivilegesBean> list = gateway.getPrivileges();
Map<Integer, CampBean> camps = new HashMap<>(); Map<Integer, CampBean> camps = new HashMap<>();
for (PrivilegesBean bean : list) { for (BusinessPrivilegesBean bean : list) {
CampBean campBean = camps.get(bean.getFkCamp()); CampBean campBean = camps.get(bean.getFkCamp());
if (campBean == null) { if (campBean == null) {
campBean = new CampBean(); campBean = new CampBean();
@ -55,11 +55,11 @@ public class PrivilegesService {
return gateway.getProfiles(allowed == null ? null : set); return gateway.getProfiles(allowed == null ? null : set);
} }
public void add(PrivilegesBean bean) { public void add(BusinessPrivilegesBean bean) {
gateway.add(bean); gateway.add(bean);
} }
public void remove(PrivilegesBean bean, String currentUser) { public void remove(BusinessPrivilegesBean bean, String currentUser) {
gateway.remove(bean, currentUser); gateway.remove(bean, currentUser);
} }
} }

View File

@ -1,55 +0,0 @@
package de.jottyfan.camporganizer.module.business.privileges;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.annotation.security.RolesAllowed;
import jakarta.websocket.server.PathParam;
/**
*
* @author jotty
*
*/
@Controller
public class PrivilegesController extends CommonController {
@Autowired
private PrivilegesService privilegesService;
@GetMapping("/business/privileges")
@RolesAllowed({ "admin" })
public String getIndex(Model model) {
String username = super.getCurrentUser();
model.addAttribute("currentUser", username);
model.addAttribute("privileges", privilegesService.getPrivileges());
model.addAttribute("profiles", privilegesService.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
model.addAttribute("bean", new PrivilegesBean());
return "business/privileges";
}
@PostMapping("/business/privileges/add")
@RolesAllowed({ "admin" })
public String getAdd(@ModelAttribute PrivilegesBean bean, Model model) {
privilegesService.add(bean);
return getIndex(model);
}
@GetMapping("/business/privileges/delete")
@RolesAllowed({ "admin" })
public String getDelete(@PathParam(value = "fkCamp") Integer fkCamp,
@PathParam(value = "fkProfile") Integer fkProfile, Model model) {
PrivilegesBean bean = new PrivilegesBean();
bean.setFkCamp(fkCamp);
bean.setFkProfile(fkProfile);
privilegesService.remove(bean, super.getCurrentUser());
return getIndex(model);
}
}

View File

@ -3,19 +3,23 @@ package de.jottyfan.camporganizer.module.business.privileges.model;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import jakarta.validation.constraints.NotNull;
/** /**
* *
* @author jotty * @author jotty
* *
*/ */
public class PrivilegesBean implements Serializable { public class BusinessPrivilegesBean implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String forename; private String forename;
private String surname; private String surname;
private String username; private String username;
private LocalDateTime duedate; private LocalDateTime duedate;
@NotNull
private Integer fkProfile; private Integer fkProfile;
@NotNull
private Integer fkCamp; private Integer fkCamp;
private String campName; private String campName;
private Double campYear; private Double campYear;

View File

@ -42,7 +42,7 @@ public class CamplistController extends CommonController {
} }
@PostMapping("/dashboard/update") @PostMapping("/dashboard/update")
public String updateBooking(Model model, @ModelAttribute BookingBean bean) { public String updateBooking(Model model, @ModelAttribute("bean") BookingBean bean) {
service.update(bean); service.update(bean);
return dashboard(model); return dashboard(model);
} }

View File

@ -32,7 +32,7 @@ public class ConfirmationBoardController extends CommonController {
} }
@GetMapping("/confirmation/board/camp/{id}") @GetMapping("/confirmation/board/camp/{id}")
public String getCamplist(Model model, @PathVariable Integer id, Principal principal) { public String getCamplist(Model model, @PathVariable("id") Integer id, Principal principal) {
model.addAttribute("campId", id); model.addAttribute("campId", id);
model.addAttribute("campStartDate", service.getCampStartDate(super.getCurrentUser(principal), id)); model.addAttribute("campStartDate", service.getCampStartDate(super.getCurrentUser(principal), id));
model.addAttribute("persons", service.loadPersonList(super.getCurrentUser(principal), id)); model.addAttribute("persons", service.loadPersonList(super.getCurrentUser(principal), id));
@ -40,7 +40,7 @@ public class ConfirmationBoardController extends CommonController {
} }
@GetMapping("/confirmation/board/download/{id}") @GetMapping("/confirmation/board/download/{id}")
public void getCsvOfAll(@PathVariable Integer id, Principal principal, HttpServletResponse response) public void getCsvOfAll(@PathVariable("id") Integer id, Principal principal, HttpServletResponse response)
throws IOException { throws IOException {
response.setContentType("text/csv"); response.setContentType("text/csv");
String filename = String.format("camplist_%d_%s.csv", id, String filename = String.format("camplist_%d_%s.csv", id,

View File

@ -4,11 +4,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.websocket.server.PathParam;
/** /**
* *
@ -26,7 +26,7 @@ public class SearchController extends CommonController {
@GetMapping("/confirmation/search") @GetMapping("/confirmation/search")
@ResponseBody @ResponseBody
public String search(@PathParam(value = "needle") String needle, Model model) { public String search(@RequestParam("needle") String needle, Model model) {
return service.search(needle, request.getRequestURI().replace("search", "person"), super.getCurrentUser()); return service.search(needle, request.getRequestURI().replace("search", "person"), super.getCurrentUser());
} }
} }

View File

@ -23,7 +23,7 @@ public class PersonController extends CommonController {
private PersonService personService; private PersonService personService;
@GetMapping("/confirmation/person/{pk}") @GetMapping("/confirmation/person/{pk}")
public String getIndex(Model model, @PathVariable Integer pk) { public String getIndex(Model model, @PathVariable("pk") Integer pk) {
String username = super.getCurrentUser(); String username = super.getCurrentUser();
model.addAttribute("currentUser", username); model.addAttribute("currentUser", username);
model.addAttribute("person", personService.getPerson(username, pk)); model.addAttribute("person", personService.getPerson(username, pk));
@ -33,7 +33,7 @@ public class PersonController extends CommonController {
} }
@PostMapping("/confirmation/person/update") @PostMapping("/confirmation/person/update")
public String doUpdate(@ModelAttribute PersonBean bean, Model model) { public String doUpdate(@ModelAttribute("bean") PersonBean bean, Model model) {
String username = super.getCurrentUser(); String username = super.getCurrentUser();
personService.updatePerson(bean, username); personService.updatePerson(bean, username);
return "redirect:/confirmation"; return "redirect:/confirmation";

View File

@ -10,9 +10,8 @@ import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.camplist.CommonController;
@ -28,8 +27,8 @@ public class DocumentController extends CommonController {
@Autowired @Autowired
private DocumentService service; private DocumentService service;
@RequestMapping(path = "/document/{id}", method = RequestMethod.GET) @GetMapping("/document/{id}")
public ResponseEntity<Resource> getDocument(@PathVariable Integer id, HttpServletResponse response) { public ResponseEntity<Resource> getDocument(@PathVariable("id") Integer id, HttpServletResponse response) {
DownloadBean bean = service.getDocument(id); DownloadBean bean = service.getDocument(id);
if (bean != null) { if (bean != null) {
byte[] decoded = Base64.getDecoder().decode(bean.getContent()); byte[] decoded = Base64.getDecoder().decode(bean.getContent());

View File

@ -72,19 +72,19 @@ public class RegistrationController extends CommonController {
} }
@GetMapping("/registration/cancel/{id}") @GetMapping("/registration/cancel/{id}")
public String cancellation(@PathVariable Integer id, final Model model) { public String cancellation(@PathVariable("id") Integer id, final Model model) {
model.addAttribute("bean", service.getBooking(id)); model.addAttribute("bean", service.getBooking(id));
return "/registration/cancellation"; return "/registration/cancellation";
} }
@GetMapping("/registration/remove/{id}") @GetMapping("/registration/remove/{id}")
public String remove(@PathVariable Integer id, final Model model) { public String remove(@PathVariable("id") Integer id, final Model model) {
service.removeBooking(id); service.removeBooking(id);
return "redirect:/dashboard"; return "redirect:/dashboard";
} }
@GetMapping("/registration/toggleconsent/{id}") @GetMapping("/registration/toggleconsent/{id}")
public String toggleConsent(@PathVariable Integer id, final Model model) { public String toggleConsent(@PathVariable("id") Integer id, final Model model) {
service.toggleConsent(id); service.toggleConsent(id);
return "redirect:/dashboard"; return "redirect:/dashboard";
} }

View File

@ -1,6 +1,5 @@
package de.jottyfan.camporganizer.module.registration; package de.jottyfan.camporganizer.module.registration;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -90,7 +89,7 @@ public class RegistrationService {
/** /**
* get already registered entries from the database * get already registered entries from the database
* *
* @param currentUser the name of the current user; may be null * @param currentUser the name of the current user; may be null
* @return the list or null if current user is null * @return the list or null if current user is null
*/ */

View File

@ -21,7 +21,7 @@ public class RssController extends CommonController {
private RssService service; private RssService service;
@GetMapping("/rss/{recipientCode}") @GetMapping("/rss/{recipientCode}")
public void toRssDirectly(@PathVariable String recipientCode, HttpServletResponse response) { public void toRssDirectly(@PathVariable("recipientCode") String recipientCode, HttpServletResponse response) {
service.getRss(recipientCode, response); service.getRss(recipientCode, response);
} }
} }

View File

@ -1,5 +1,5 @@
# database credentials from defined config file # database credentials from defined config file
spring.config.import = /etc/CampOrganizer2/prod.properties spring.config.import = /etc/camporganizer.properties
# define overwriteable arguments # define overwriteable arguments
spring.datasource.driver-class-name = ${spring.datasource.driver-class-name:org.postgresql.Driver} spring.datasource.driver-class-name = ${spring.datasource.driver-class-name:org.postgresql.Driver}
@ -35,7 +35,3 @@ spring.mail.protocol = ${spring.mail.protocol}
spring.mail.test-connection = ${spring.mail.test-connection} spring.mail.test-connection = ${spring.mail.test-connection}
spring.mail.properties.mail.smtp.auth = ${spring.mail.properties.mail.smtp.auth} spring.mail.properties.mail.smtp.auth = ${spring.mail.properties.mail.smtp.auth}
spring.mail.properties.mail.smtp.starttls.enable = ${spring.mail.properties.mail.smtp.starttls.enable} spring.mail.properties.mail.smtp.starttls.enable = ${spring.mail.properties.mail.smtp.starttls.enable}
# for development only
server.port = 8081

View File

@ -45,6 +45,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-9"> <div class="col-sm-9">
<div th:if="${#fields.hasErrors('fkProfile')}" th:errorclass="error" th:errors="*{fkProfile}"></div>
<select th:id="${e.value.pk}" class="form-control select2-single" th:field="*{fkProfile}"> <select th:id="${e.value.pk}" class="form-control select2-single" th:field="*{fkProfile}">
<option value="">Auswählen</option> <option value="">Auswählen</option>
<th:block th:each="u : ${profiles}"> <th:block th:each="u : ${profiles}">

View File

@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap/5.3.2/css/bootstrap.min.css} " /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap/5.3.2/css/bootstrap.min.css} " />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/font-awesome/6.4.2/css/all.min.css} " /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/font-awesome/6.5.1/css/all.min.css} " />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/datatables/1.13.5/css/jquery.dataTables.min.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/datatables/1.13.5/css/jquery.dataTables.min.css}" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/select2/4.0.13/css/select2.min.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/select2/4.0.13/css/select2.min.css}" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/css/style.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/css/style.css}" />
@ -22,9 +22,6 @@
<body> <body>
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light headerlayout navbar-background"> <nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light headerlayout navbar-background">
<span class="navbar-brand"><img th:src="@{/images/logo.png}" width="128px" style="margin-left: 8px" /></span> <span class="navbar-brand"><img th:src="@{/images/logo.png}" width="128px" style="margin-left: 8px" /></span>
<!-- remove? -->
<!-- <div class="container-fluid">
<!-- -->
<button class="navbar-toggler" style="margin-right: 40px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" <button class="navbar-toggler" style="margin-right: 40px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false"> aria-expanded="false">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
@ -145,7 +142,6 @@
</li> </li>
</ul> </ul>
</div> </div>
<!-- </div> -->
</nav> </nav>
<div layout:fragment="content">content</div> <div layout:fragment="content">content</div>
<br /> <br />