From 10ba9a46f14d2c4b8786e529fea4130da637faca Mon Sep 17 00:00:00 2001 From: vbillard91 Date: Mon, 6 Oct 2025 10:00:34 +0200 Subject: [PATCH 1/5] fix(rights): #COCO-4531 add constructor override for backward compatibility (#38) --- .../java/fr/wseduc/webutils/security/SecuredAction.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/fr/wseduc/webutils/security/SecuredAction.java b/src/main/java/fr/wseduc/webutils/security/SecuredAction.java index a7ecedb..ca13383 100644 --- a/src/main/java/fr/wseduc/webutils/security/SecuredAction.java +++ b/src/main/java/fr/wseduc/webutils/security/SecuredAction.java @@ -30,6 +30,14 @@ public SecuredAction(String qualifiedName, String displayName, String type, Stri this.right = right; } + public SecuredAction(String qualifiedName, String displayName, String type) { + this.name = qualifiedName; + this.displayName = displayName; + this.type = type; + this.right = qualifiedName; + } + + public String getName() { return name; } From 952124bfdeb38d565247516e6bb23ab164df01fd Mon Sep 17 00:00:00 2001 From: jenkinsEdificePublic Date: Tue, 14 Oct 2025 11:48:59 +0200 Subject: [PATCH 2/5] chore: prepare next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 825a5b2..12afd42 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ fr.wseduc web-utils - 3.2-SNAPSHOT + 3.2-develop-b2school-SNAPSHOT From 773b4378ec53ca62227dd4f735f18bde550676f7 Mon Sep 17 00:00:00 2001 From: Vincent Billard Date: Thu, 18 Sep 2025 10:23:30 +0200 Subject: [PATCH 3/5] fix-(communication): add missing import due to rebase --- .../java/fr/wseduc/webutils/http/Renders.java | 24 +++++-- .../webutils/template/TemplateProcessor.java | 70 ++++++++++++++----- 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/src/main/java/fr/wseduc/webutils/http/Renders.java b/src/main/java/fr/wseduc/webutils/http/Renders.java index 520f973..87dbaba 100644 --- a/src/main/java/fr/wseduc/webutils/http/Renders.java +++ b/src/main/java/fr/wseduc/webutils/http/Renders.java @@ -20,8 +20,11 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import com.samskivert.mustache.Mustache; import fr.wseduc.webutils.template.TemplateProcessor; import fr.wseduc.webutils.template.FileTemplateProcessor; import fr.wseduc.webutils.template.lambdas.FormatBirthDateLambda; @@ -57,6 +60,7 @@ public class Renders { protected String staticHost; protected FileTemplateProcessor templateProcessor; protected static final List allowedHosts = new ArrayList<>(); + private final Map staticLambdas = new HashMap<>(); public Renders(Vertx vertx, JsonObject config) { this.config = config; @@ -66,8 +70,10 @@ public Renders(Vertx vertx, JsonObject config) { this.vertx = vertx; if (vertx != null) { this.templateProcessor = new FileTemplateProcessor(vertx, "view/", false); - this.templateProcessor.setLambda("formatBirthDate", new FormatBirthDateLambda()); - this.templateProcessor.setLambda("modVersion", new ModsLambda(vertx)); + staticLambdas.put("formatBirthDate", new FormatBirthDateLambda()); + staticLambdas.put("modVersion", new ModsLambda(vertx)); + + staticLambdas.forEach(templateProcessor::setLambda); } } @@ -84,13 +90,15 @@ protected void init(Vertx vertx, JsonObject config) if (templateProcessor == null && vertx != null) { this.templateProcessor = new FileTemplateProcessor(vertx, "view/", false); - this.templateProcessor.setLambda("formatBirthDate", new FormatBirthDateLambda()); - this.templateProcessor.setLambda("modVersion", new ModsLambda(vertx)); + staticLambdas.put("formatBirthDate", new FormatBirthDateLambda()); + staticLambdas.put("modVersion", new ModsLambda(vertx)); + + staticLambdas.forEach(templateProcessor::setLambda); } } - protected void setLambdaTemplateRequest(final HttpServerRequest request) - { + @Deprecated + protected void setLambdaTemplateRequest(final HttpServerRequest request) { String host = Renders.getHost(request); if(host == null) // This can happen for forged requests host = ""; @@ -104,6 +112,10 @@ protected void setLambdaTemplateRequest(final HttpServerRequest request) this.templateProcessor.setLambda("datetime", new LocaleDateLambda(I18n.acceptLanguage(request))); } + protected Map getLambdasFromRequest() { + return null; + } + public void renderView(HttpServerRequest request) { renderView(request, new JsonObject()); } diff --git a/src/main/java/fr/wseduc/webutils/template/TemplateProcessor.java b/src/main/java/fr/wseduc/webutils/template/TemplateProcessor.java index 8f5176f..2f34f2f 100644 --- a/src/main/java/fr/wseduc/webutils/template/TemplateProcessor.java +++ b/src/main/java/fr/wseduc/webutils/template/TemplateProcessor.java @@ -52,12 +52,14 @@ public TemplateProcessor() // =========================================== COMPILER CONFIGURATION =========================================== + @Deprecated public TemplateProcessor setLambda(String identifier, Mustache.Lambda lambda) { this.templateLambdas.put(identifier, lambda); return this; } + @Deprecated public TemplateProcessor clearLambda(String identifier) { this.templateLambdas.remove(identifier); @@ -79,6 +81,7 @@ public TemplateProcessor escapeHTML(boolean enableHTMLEscaping) // ============================================= TEMPLATE PROCESSING ============================================ + @Deprecated public void processTemplate(String templateString, JsonObject params, final Handler handler) { this.processTemplateToWriter(templateString, params, new Handler() @@ -91,6 +94,20 @@ public void handle(Writer w) }); } + public void processTemplate(String templateString, JsonObject params, Map lambdas, + final Handler handler) + { + this.processTemplateToWriter(templateString, params, lambdas, new Handler() + { + @Override + public void handle(Writer w) + { + handler.handle(w == null ? null : w.toString()); + } + }); + } + + @Deprecated public void processTemplateToWriter(String templateString, JsonObject params, final Handler handler) { this.getTemplate(templateString, new Handler