@Override
  public boolean isPaymentPermitted(Integer accountId) {

    MifosUser user =
        (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);

    try {
      AccountBO account = new AccountBusinessService().getAccount(accountId);

      CustomerLevel customerLevel = null;
      if (account.getType().equals(AccountTypes.CUSTOMER_ACCOUNT)) {
        customerLevel = account.getCustomer().getLevel();
      }

      Short personnelId = userContext.getId();
      if (account.getPersonnel() != null) {
        personnelId = account.getPersonnel().getPersonnelId();
      }

      return ActivityMapper.getInstance()
          .isPaymentPermittedForAccounts(
              account.getType(),
              customerLevel,
              userContext,
              account.getOffice().getOfficeId(),
              personnelId);
    } catch (ServiceException e) {
      throw new MifosRuntimeException(e);
    }
  }
 private boolean isPermissionAllowed(
     AccountTypes accountTypes,
     CustomerLevel customerLevel,
     UserContext userContext,
     Short recordOfficeId,
     Short recordLoanOfficerId) {
   return ActivityMapper.getInstance()
       .isApplyChargesPermittedForAccounts(
           accountTypes, customerLevel, userContext, recordOfficeId, recordLoanOfficerId);
 }
예제 #3
0
 private boolean isPermissionAllowed(
     UserContext userContext, Short recordOfficeId, Short recordLoanOfficerId) {
   return ActivityMapper.getInstance()
       .isAddingNotesPermittedForPersonnel(userContext, recordOfficeId, recordLoanOfficerId);
 }