Remove duplicate code from HealthWebEndpointResponseMapper

Closes gh-15784
This commit is contained in:
Vedran Pavic 2019-01-25 09:03:10 +01:00 committed by Stephane Nicoll
parent c488934c7d
commit d7550d73a3
1 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -88,10 +88,7 @@ public class HealthWebEndpointResponseMapper {
*/
public WebEndpointResponse<Health> map(Health health, SecurityContext securityContext,
ShowDetails showDetails) {
if (showDetails == ShowDetails.NEVER
|| (showDetails == ShowDetails.WHEN_AUTHORIZED
&& (securityContext.getPrincipal() == null
|| !isUserInRole(securityContext)))) {
if (!canSeeDetails(securityContext, showDetails)) {
health = Health.status(health.getStatus()).build();
}
return createWebEndpointResponse(health);