Skip to content

Commit

Permalink
misc cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Jul 18, 2019
1 parent 4981c61 commit 371c00d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/java/alfio/config/Initializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void configureSessionCookie(ServletContext servletContext) {
// set secure cookie only if current environment doesn't strictly need HTTP
config.setSecure(environment.acceptsProfiles(Profiles.of(Initializer.PROFILE_LIVE)));

// FIXME and CHECKME what a mess, ouch: https://issues.jboss.org/browse/WFLY-3448 ?
// https://issues.jboss.org/browse/WFLY-3448 ?
config.setPath(servletContext.getContextPath() + "/");
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/alfio/config/RoleAndOrganizationsAspect.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class RoleAndOrganizationsAspect {
new AntPathRequestMatcher("/api/events/**"),
new AntPathRequestMatcher("/api/webhook/**"),
new AntPathRequestMatcher("/api/payment/**"),
new AntPathRequestMatcher("/api/pass/**"),
new AntPathRequestMatcher("/api/v2/info"),
new AntPathRequestMatcher("/api/v2/public/**"),
new AntPathRequestMatcher("/session-expired"),
Expand Down Expand Up @@ -115,11 +116,7 @@ public Object setRoleAndVariable(ProceedingJoinPoint joinPoint) throws Throwable
if (DataSourceUtils.isConnectionTransactional(connection, dataSource)) {
jdbcTemplate.update("reset alfio.checkRowAccess", new EmptySqlParameterSource());
jdbcTemplate.update("reset alfio.currentUserOrgs", new EmptySqlParameterSource());
//System.err.println(request.getRequestURL()+" - "+joinPoint+" LOCAL VALUES ARE: alfio.checkRowAccess: " + jdbcTemplate.queryForObject("select current_setting('alfio.checkRowAccess', true)", new EmptySqlParameterSource(), String.class));
//System.err.println(request.getRequestURL()+" - "+joinPoint+" LOCAL VALUES ARE: alfio.currentUserOrgs: " + jdbcTemplate.queryForObject("select current_setting('alfio.currentUserOrgs', true)", new EmptySqlParameterSource(), String.class));
//System.err.println(request.getRequestURL()+" - "+joinPoint+" result from function call is:" + jdbcTemplate.queryForObject("select alfio_check_row_access(null)", new EmptySqlParameterSource(), Boolean.class));
Set<Integer> orgIds = new TreeSet<>(organizationRepository.findAllOrganizationIdForUser(SecurityContextHolder.getContext().getAuthentication().getName()));
//System.err.println(joinPoint+" org ids are " + orgIds);
if (orgIds.isEmpty()) {
log.warn("orgIds is empty, was not able to apply currentUserOrgs at join point: {}", joinPoint);
} else {
Expand All @@ -143,6 +140,9 @@ public Object setRoleAndVariable(ProceedingJoinPoint joinPoint) throws Throwable
return joinPoint.proceed();
}


private static final String LINE_SEPARATOR = "-----------\n";

private static void logEntry(Connection connection, DataSource dataSource,
ProceedingJoinPoint joinPoint,
HttpServletRequest request,
Expand All @@ -153,7 +153,7 @@ private static void logEntry(Connection connection, DataSource dataSource,


if (connection != null && DataSourceUtils.isConnectionTransactional(connection, dataSource)) {
sb.append("-----------\n");
sb.append(LINE_SEPARATOR);
sb.append("connection is transactional\n");
sb.append("URL IS ").append(request.getRequestURI()).append("\n");
sb.append(request.getRequestURL()).append("\n");
Expand All @@ -171,14 +171,14 @@ private static void logEntry(Connection connection, DataSource dataSource,
if(mustCheck) {
sb.append("org ids are: ").append(formattedOrgIds).append("\n");
}
sb.append("-----------\n");
sb.append(LINE_SEPARATOR);

} else {
sb.append("-----------\n");
sb.append(LINE_SEPARATOR);
sb.append("connection is NOT transactional so the check will not be done!\n");
sb.append("URL IS ").append(request.getRequestURI()).append("\n");
sb.append(joinPoint).append("\n");
sb.append("-----------\n");
sb.append(LINE_SEPARATOR);
}

log.trace(sb.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ public ResponseEntity<ValidatedResponse<ReservationPaymentResult>> confirmOvervi
String errorMessageCode = status.getErrorCode().orElse(StripeCreditCardManager.STRIPE_UNEXPECTED);
MessageSourceResolvable message = new DefaultMessageSourceResolvable(new String[]{errorMessageCode, StripeCreditCardManager.STRIPE_UNEXPECTED});
bindingResult.reject(ErrorsCode.STEP_2_PAYMENT_PROCESSING_ERROR, new Object[]{messageSource.getMessage(message, locale)}, null);
//SessionUtil.addToFlash(bindingResult, redirectAttributes);
//SessionUtil.removePaymentToken(request);
return buildReservationPaymentStatus(bindingResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public boolean hasAllConfigurationsForInvoice(EventAndOrganizationId event) {
return r.get(INVOICE_ADDRESS).isPresent() && r.get(VAT_NR).isPresent();
}

@Deprecated

public boolean isRecaptchaForOfflinePaymentEnabled(EventAndOrganizationId event) {
var conf = getFor(event, Set.of(ENABLE_CAPTCHA_FOR_OFFLINE_PAYMENTS, RECAPTCHA_API_KEY));
return conf.get(ENABLE_CAPTCHA_FOR_OFFLINE_PAYMENTS).getValueAsBooleanOrDefault(false) &&
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/alfio/model/system/ConfigurationKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public enum ConfigurationKeys {
OFFLINE_PAYMENT_DAYS("Maximum number of days allowed to pay an offline ticket", false, SettingCategory.PAYMENT_OFFLINE, ComponentType.TEXT, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT)),
OFFLINE_REMINDER_HOURS("How many hours before expiration should be sent a reminder e-mail for offline payments?", false, SettingCategory.PAYMENT_OFFLINE, ComponentType.TEXT, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT)),

@Deprecated

ENABLE_CAPTCHA_FOR_OFFLINE_PAYMENTS("Enable captcha for offline payments / free of charge tickets (default false)", false, SettingCategory.PAYMENT_OFFLINE, ComponentType.BOOLEAN, false, EnumSet.of(SYSTEM)),
BANK_ACCOUNT_NR("Bank Account number", false, SettingCategory.PAYMENT_OFFLINE, ComponentType.TEXT, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT)),
BANK_ACCOUNT_OWNER("Bank Account owner", false, SettingCategory.PAYMENT_OFFLINE, ComponentType.TEXTAREA, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT)),
Expand Down

0 comments on commit 371c00d

Please sign in to comment.