diff --git a/.classpath b/.classpath index f3bdce0..607b789 100644 --- a/.classpath +++ b/.classpath @@ -12,6 +12,13 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 9c1b977..165c5ca 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,8 +1,14 @@ - - - - - - - + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle index 36bdd43..78c809e 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'de.jottyfan.bico' -version = '0.1.4' +version = '0.1.5' description = """BibleClassOrganizer""" @@ -83,3 +83,8 @@ test { springBoot { buildInfo() } + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs.add("-parameters") +} + diff --git a/src/main/java/de/jottyfan/bico/modules/CommonController.java b/src/main/java/de/jottyfan/bico/modules/CommonController.java index 32ac948..4d65350 100644 --- a/src/main/java/de/jottyfan/bico/modules/CommonController.java +++ b/src/main/java/de/jottyfan/bico/modules/CommonController.java @@ -42,7 +42,7 @@ public abstract class CommonController { return false; } } - + @ModelAttribute("hasDateRole") public Boolean hasDateRole(Principal principal) { OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal; @@ -56,6 +56,21 @@ public abstract class CommonController { return false; } } + + @ModelAttribute("hasAnyRole") + public Boolean hasAnyRole(Principal principal) { + OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal; + if (token != null) { + OAuth2User user = token.getPrincipal(); + @SuppressWarnings("unchecked") + List roles = (List) user.getAttributes().get("roles"); + return roles.size() > 0; + } else { + LOGGER.warn("token is null, no roles can be detected"); + return false; + } + } + /** * get the theme for the current session * diff --git a/src/main/java/de/jottyfan/bico/modules/lesson/LessonRepository.java b/src/main/java/de/jottyfan/bico/modules/lesson/LessonRepository.java index ac40296..1e900ff 100644 --- a/src/main/java/de/jottyfan/bico/modules/lesson/LessonRepository.java +++ b/src/main/java/de/jottyfan/bico/modules/lesson/LessonRepository.java @@ -23,10 +23,10 @@ import de.jottyfan.bico.db.tables.records.TLessonRecord; import de.jottyfan.bico.db.tables.records.TPersonRecord; /** -* -* @author jotty -* -*/ + * + * @author jotty + * + */ @Repository public class LessonRepository { private final static Logger LOGGER = LogManager.getLogger(LessonRepository.class); diff --git a/src/main/java/de/jottyfan/bico/modules/profile/ProfileController.java b/src/main/java/de/jottyfan/bico/modules/profile/ProfileController.java index 6c78592..1319521 100644 --- a/src/main/java/de/jottyfan/bico/modules/profile/ProfileController.java +++ b/src/main/java/de/jottyfan/bico/modules/profile/ProfileController.java @@ -25,7 +25,7 @@ public class ProfileController extends CommonController { * @param theme the theme */ @PostMapping("/updateTheme/{theme}") - public ResponseEntity updateTheme(@PathVariable String theme) { + public ResponseEntity updateTheme(@PathVariable("theme") String theme) { // TODO: add profile's user name String username = "jotty"; service.updateTheme(username, theme); diff --git a/src/main/java/de/jottyfan/bico/modules/slot/SlotController.java b/src/main/java/de/jottyfan/bico/modules/slot/SlotController.java index 3f27594..c5f6bda 100644 --- a/src/main/java/de/jottyfan/bico/modules/slot/SlotController.java +++ b/src/main/java/de/jottyfan/bico/modules/slot/SlotController.java @@ -30,20 +30,20 @@ public class SlotController extends CommonController { } @GetMapping("/slot/{id}") - public String load(@PathVariable Integer id, Model model) { + public String load(@PathVariable("id") Integer id, Model model) { model.addAttribute("bean", id == null ? new SlotBean() : service.loadSlot(id)); model.addAttribute("hasLesson", service.slotHasLesson(id)); return "/slot/item"; } @GetMapping("/slot/{id}/delete") - public String loadEnsurance(@PathVariable Integer id, Model model) { + public String loadEnsurance(@PathVariable("id") Integer id, Model model) { model.addAttribute("bean", service.loadDeletableSlot(id)); return "/slot/delete"; } @GetMapping("/slot/{id}/destroy") - public String destroy(@PathVariable Integer id, Model model) { + public String destroy(@PathVariable("id") Integer id, Model model) { service.removeSlot(id); return "redirect:/"; } diff --git a/src/main/java/de/jottyfan/bico/modules/slot/SlotRepository.java b/src/main/java/de/jottyfan/bico/modules/slot/SlotRepository.java index d728da3..0daf638 100644 --- a/src/main/java/de/jottyfan/bico/modules/slot/SlotRepository.java +++ b/src/main/java/de/jottyfan/bico/modules/slot/SlotRepository.java @@ -139,7 +139,7 @@ public class SlotRepository { .selectFrom(T_LESSON) .where(T_LESSON.FK_SLOT.eq(slotId)); // @formatter:on - LOGGER.trace(sql); + LOGGER.info(sql); return sql.fetch().size() > 0; } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 3f48596..7801ebd 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -15,3 +15,4 @@ spring.security.oauth2.client.registration.nextcloud.client-id = ${nextcloud.cli spring.security.oauth2.client.registration.nextcloud.client-secret = ${nextcloud.client-secret} spring.security.oauth2.client.registration.nextcloud.authorization-grant-type = authorization_code spring.security.oauth2.client.registration.nextcloud.redirect-uri = ${nextcloud.redirect-uri} +spring.security.oauth2.client.registration.nextcloud.client-authentication-method = client_secret_post diff --git a/src/main/resources/templates/lesson/item.html b/src/main/resources/templates/lesson/item.html index d78c4c5..345b74a 100644 --- a/src/main/resources/templates/lesson/item.html +++ b/src/main/resources/templates/lesson/item.html @@ -30,7 +30,8 @@ diff --git a/src/main/resources/templates/sheet.html b/src/main/resources/templates/sheet.html index 7eaaa2d..9b72417 100644 --- a/src/main/resources/templates/sheet.html +++ b/src/main/resources/templates/sheet.html @@ -14,7 +14,7 @@ - + @@ -32,8 +32,7 @@ - - + diff --git a/src/main/resources/templates/template.html b/src/main/resources/templates/template.html index 95a5ec6..3ca7cfb 100644 --- a/src/main/resources/templates/template.html +++ b/src/main/resources/templates/template.html @@ -24,7 +24,7 @@ -
content
-
+
content
+
Leider fehlen Ihnen die Berechtigungen, um diese Anwendung nutzen zu können.