Ejemplo n.º 1
0
  @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);
    }
  }
Ejemplo n.º 2
0
 private boolean isPermissionAllowed(
     AccountTypes accountTypes,
     CustomerLevel customerLevel,
     UserContext userContext,
     Short recordOfficeId,
     Short recordLoanOfficerId) {
   return ActivityMapper.getInstance()
       .isApplyChargesPermittedForAccounts(
           accountTypes, customerLevel, userContext, recordOfficeId, recordLoanOfficerId);
 }
Ejemplo n.º 3
0
 private boolean isPermissionAllowed(
     UserContext userContext, Short recordOfficeId, Short recordLoanOfficerId) {
   return ActivityMapper.getInstance()
       .isAddingNotesPermittedForPersonnel(userContext, recordOfficeId, recordLoanOfficerId);
 }