vidakovic commented on code in PR #3994:
URL: https://github.com/apache/fineract/pull/3994#discussion_r1695262316
##########
custom/v3/note/util/src/main/java/org/apache/fineract/v3/note/util/NoteUtilityMethods.java:
##########
@@ -68,35 +68,18 @@ public static NoteType getNoteType(final String
resourceType) {
}
private static <T> CommandTypedWrapper<T> getResourceDetails(final
NoteType type, final Long resourceId, CommandTypedWrapper<T> resourceDetails) {
- String resourceNameForPermissions;
-
- switch (type) {
- case CLIENT -> {
- resourceNameForPermissions = CLIENTNOTE;
- resourceDetails =
resourceDetails.toBuilder().clientId(resourceId).build();
- }
- case LOAN -> {
- resourceNameForPermissions = LOANNOTE;
- resourceDetails =
resourceDetails.toBuilder().loanId(resourceId).build();
- }
- case LOAN_TRANSACTION -> {
- resourceNameForPermissions = LOANTRANSACTIONNOTE;
- // updating loanId, to distinguish saving transaction note and
- // loan transaction note as we are using subEntityId for both.
- resourceDetails =
resourceDetails.toBuilder().loanId(resourceId).build();
- resourceDetails =
resourceDetails.toBuilder().subentityId(resourceId).build();
- }
- case SAVING_ACCOUNT -> {
- resourceNameForPermissions = SAVINGNOTE;
- resourceDetails =
resourceDetails.toBuilder().savingsId(resourceId).build();
- }
- case GROUP -> {
- resourceNameForPermissions = GROUPNOTE;
- resourceDetails =
resourceDetails.toBuilder().groupId(resourceId).build();
- }
- default -> resourceNameForPermissions = INVALIDNOTE;
- }
-
- return
resourceDetails.toBuilder().entityName(resourceNameForPermissions).build();
+ String resourceNameForPermissions = switch (type) {
Review Comment:
Without even reading more details: very likely the wrong place for ANYTHING
permission related! Note: we don't need to squeeze every concept into one
class... we are going to run out of space if we create another class...
remidner: this belongs to Spring Security (remember when we talked about
"Access Desicion Voters"?).
--
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]