Shelaslifter commented on code in PR #4825:
URL: https://github.com/apache/fineract/pull/4825#discussion_r2258399982


##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java:
##########
@@ -597,4 +599,15 @@ public void checkForUnsupportedParameters(final Type 
typeOfMap, final String jso
         this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, 
requestDataParameters);
     }
 
+    public String getClientIp() {
+        ServletRequestAttributes attrs = (ServletRequestAttributes) 
RequestContextHolder.getRequestAttributes();
+        String clientIp = "";
+        if (attrs != null) {
+            Object ipAttr = attrs.getRequest().getAttribute("IP");
+            if (ipAttr != null) {
+                clientIp = ipAttr.toString();
+            }
+        }
+        return clientIp;

Review Comment:
   As mentioned, the filter keeps IP tracking optional. Using a utility class 
would make capture automatic, with no option to skip. Creating a separate class 
for this would add unnecessary overhead, as the filter already fulfills the 
required functionality.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to