Skip to content

Commit 683156a

Browse files
committed
Fixes for API access control when user has GET permissions
1 parent 108cacd commit 683156a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/computate/frFR/java/EcrireApiClasse.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,11 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
22532253
tl(5, "scopes.add(\"GET\");");
22542254
tl(5, "scopes.add(\"PATCH\");");
22552255
}
2256-
tl(5, "if(authorizationDecisionResponse.failed() && !scopes.contains(\"", classeApiMethodeMethode, "\")) {");
2256+
if(StringUtils.equals(classeApiMethodeMethode, "GET")) {
2257+
tl(5, "if(authorizationDecisionResponse.failed() && !scopes.contains(\"", classeApiMethodeMethode, "\")) {");
2258+
} else {
2259+
tl(5, "if(authorizationDecisionResponse.failed() || !scopes.contains(\"", classeApiMethodeMethode, "\")) {");
2260+
}
22572261
tl(6, "String msg = String.format(\"403 FORBIDDEN user %s to %s %s\", siteRequest.getUser().attributes().getJsonObject(\"accessToken\").getString(\"preferred_username\"), serviceRequest.getExtra().getString(\"method\"), serviceRequest.getExtra().getString(\"uri\"));");
22582262
tl(6, "eventHandler.handle(Future.succeededFuture(");
22592263
tl(7, "new ServiceResponse(403, \"FORBIDDEN\",");

0 commit comments

Comments
 (0)