diff --git a/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandSourceService.java b/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandSourceService.java index 686924583..511d8dead 100644 --- a/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandSourceService.java +++ b/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandSourceService.java @@ -169,12 +169,26 @@ public class CommandSourceService { || "RECURRINGDEPOSITPRODUCT".equalsIgnoreCase(commandSource.getEntityName()) || "USER".equalsIgnoreCase(commandSource.getEntityName()) || "ROLE".equalsIgnoreCase(commandSource.getEntityName()) - || isDdsEntity(commandSource.getEntityName())) { + || isDdsEntity(commandSource.getEntityName()) + || isInvestmentEntity(commandSource.getEntityName())) { return false; } return true; } + /** + * The Investment module's maker-checker entities. Deals, settlements and their vouchers are entered by one person and + * approved by another, so a super user's investment work goes to a checker as well. Unlike DDS, a super user may still + * check an entry they made themselves. Daily rates are not here: they are entered without approval. + */ + public static boolean isInvestmentEntity(final String entityName) { + return entityName != null && switch (entityName.toUpperCase()) { + case "INVESTMENTPARTY", "INVESTMENTSCRIPT", "INVESTMENTPURCHASE", "INVESTMENTSALE", "INVESTMENTFD", "INVESTMENTTRANSFER", + "INVESTMENTINTEREST", "INVESTMENTVALUATION" -> true; + default -> false; + }; + } + /** * The DDS module's maker-checker entities. A super user's DDS work goes to a checker like anyone * else's: DDS moves customers' money, and every such move is to be approved by a second person. diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml index 3a78a8364..097253609 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml @@ -202,4 +202,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0611_investment_maker_checker.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0611_investment_maker_checker.xml new file mode 100644 index 000000000..bd65d2d92 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0611_investment_maker_checker.xml @@ -0,0 +1,47 @@ + + + + + + + + UPDATE m_permission + SET can_maker_checker = TRUE + WHERE code IN ('CREATE_INVESTMENTPARTY', 'UPDATE_INVESTMENTPARTY', 'DELETE_INVESTMENTPARTY', + 'CREATE_INVESTMENTSCRIPT', 'UPDATE_INVESTMENTSCRIPT', + 'CREATE_INVESTMENTPURCHASE', 'SETTLE_INVESTMENTPURCHASE', 'DELETE_INVESTMENTPURCHASE', + 'CREATE_INVESTMENTSALE', 'SETTLE_INVESTMENTSALE', 'DELETE_INVESTMENTSALE', 'REDEEM_INVESTMENTSALE', + 'WRITEOFF_INVESTMENTSALE', 'AMORTISE_INVESTMENTSALE', 'SWITCH_INVESTMENTSALE', + 'CREATE_INVESTMENTFD', 'MATURE_INVESTMENTFD', 'PREMATURE_INVESTMENTFD', 'RENEW_INVESTMENTFD', + 'POSTINTEREST_INVESTMENTFD', 'SETBASE_INVESTMENTFD', + 'CREATE_INVESTMENTTRANSFER', 'CREATE_INVESTMENTINTEREST', 'CREATE_INVESTMENTVALUATION') + + +