[
https://issues.apache.org/jira/browse/FINERACT-2864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Saghy updated FINERACT-2864:
---------------------------------
Fix Version/s: 1.16.0
> Audit and maker-checker search templates return empty appUsers entries
> ----------------------------------------------------------------------
>
> Key: FINERACT-2864
> URL: https://issues.apache.org/jira/browse/FINERACT-2864
> Project: Apache Fineract
> Issue Type: Bug
> Components: System
> Reporter: Foo Developer
> Assignee: Foo Developer
> Priority: Major
> Fix For: 1.16.0
>
>
> h3. Steps to reproduce
> On a stock Fineract instance (any tenant with at least one application user),
> call the audit search template:
> {code}GET /fineract-provider/api/v1/audits/searchtemplate
> {code}
> The maker-checker search template behaves the same way:
> {code}GET /fineract-provider/api/v1/makercheckers/searchtemplate
> {code}
> h3. Expected
> Each entry of {{appUsers}} carries the user's {{id}} and {{username}}, so a
> UI can fill the "User" / "Checker" dropdowns of the audit and checker inbox
> search screens:
> {code:json}{
> "appUsers": [ { "id": 1, "username": "mifos" } ],
> "actionNames": [ ... ],
> "entityNames": [ ... ],
> "statuses": [ ... ]
> }
> {code}
> h3. Actual
> HTTP 200, but every {{appUsers}} entry is an empty object. No error is logged:
> {code:json}{
> "appUsers": [ {}, {} ],
> ...
> }
> {code}
> h3. Root cause
> {{AuditsApiResource.retrieveAuditSearchTemplate()}} and
> {{MakercheckersApiResource.retrieveAuditSearchTemplate()}} return the
> {{AuditSearchData}} record directly, so Jersey writes it with the Jackson
> object mapper ({{JerseyJacksonObjectArgumentHandler}}) instead of the Gson
> based {{DefaultToApiJsonSerializer}} used by the other endpoints. Jackson
> only picks up properties that have a getter. {{AppUserData}} has plain
> {{private final}} fields and no getter for {{id}} or {{username}} (Gson reads
> fields directly, so no other endpoint needed one), which leaves nothing for
> Jackson to write for each user.
> h3. Proposed fix
> Add Lombok {{@Getter}} to {{AppUserData.id}} and {{AppUserData.username}},
> the only two fields {{AppUserData.dropdown(id, username)}} fills for the
> search templates. A class-level {{@Getter}} is avoided on purpose, so the
> other fields (roles, staff, clients, password flags) are not exposed through
> this Jackson path. The Gson based endpoints that use {{AppUserData}} are
> unaffected.
> h3. Test
> A serialization test that writes an {{AuditSearchData}} with the Jersey
> {{objectMapper}} bean and asserts each {{appUsers}} entry contains exactly
> {{id}} and {{username}}. It fails on current {{develop}} (empty objects) and
> passes with the fix.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)