rymghosn commented on code in PR #6209:
URL: https://github.com/apache/fineract/pull/6209#discussion_r4183311036


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java:
##########
@@ -204,6 +204,19 @@ public FineractEntityRelationData mapRow(final ResultSet 
rs, @SuppressWarnings("
     @Override
     public Collection<FineractEntityToEntityMappingData> 
retrieveEntityToEntityMappings(Long mapId, Long fromId, Long toId) {
 
+        if (fromId == 0) {

Review Comment:
   Done: the native SQL and the recursive CTEs are gone. Mappings are read 
through FineractEntityToEntityMappingRepository with an interface projection, 
and the office line through a JPQL query on Office.hierarchy (OfficeRepository).



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java:
##########
@@ -320,4 +373,49 @@ public FineractEntityToEntityMappingData mapRow(final 
ResultSet rs, @SuppressWar
         }
     }
 
+    @Override
+    public String 
getSQLQueryInClauseIDList_ForLoanProductsVisibleToOffice(final Long officeId) {
+        FineractEntityRelation fineractEntityRelation = 
fineractEntityRelationRepository
+                
.findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.getStr());
+        final Long relId = fineractEntityRelation.getId();
+        return "WITH RECURSIVE descendants AS ( " + "  SELECT id, parent_id 
FROM m_office WHERE id = " + officeId + " " + "  UNION ALL "

Review Comment:
   Done: this method is removed. Visibility is now computed once per 
tenant/office as restricted/granted id sets (repository + projection), cached 
in officeEntityAccess, and callers filter their rows by id.



-- 
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