Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dickschoeller committed May 10, 2020
1 parent 8794c60 commit def23e9
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ public ApiPerson create(
*/
@GetMapping(value = "/v1/dbs/{db}/persons")
@ResponseBody
public List<ApiPerson> read(
final HttpServletRequest request,
public List<ApiPerson> read(final HttpServletRequest request,
@PathVariable final String db) {
final List<PersonDocument> allPersons = ((PersonCrud) crud()).read(db);
return hide(request, db, allPersons);
return hide(request, allPersons);
}

private List<ApiPerson> hide(final HttpServletRequest request, final String db,
private List<ApiPerson> hide(final HttpServletRequest request,
final List<PersonDocument> allPersons) {
logger.info("Start hiding list of persons");
final List<ApiPerson> list = new ArrayList<>();
Expand All @@ -99,13 +98,13 @@ private List<ApiPerson> hide(final HttpServletRequest request, final String db,
final boolean hasAdmin = requestUserUtil.hasAdmin();
for (final PersonDocument doc : allPersons) {
final Person person = doc.getGedObject();
if (shouldHideLiving(person, hasUser)) {
if (shouldHideConfidential(person, hasAdmin)) {
continue;
}
if (shouldHideConfidential(person, hasAdmin)) {
if (shouldHideLiving(person, hasUser)) {
continue;
}
OperationsEnabler<?, ?> enabler = (OperationsEnabler<?, ?>) crud();
final OperationsEnabler<?, ?> enabler = (OperationsEnabler<?, ?>) crud();
list.add((ApiPerson) enabler.getD2dm().convert(doc));
}
logger.info("Done hiding list of persons");
Expand All @@ -126,12 +125,12 @@ public ApiPerson read(
@PathVariable final String id) {
final Person person = ((PersonCrud) crud()).read(db, id).getGedObject();
final RequestUserUtil util = new RequestUserUtil(request, userService);
if (shouldHideLiving(person, util.hasUser())) {
return createDummyLivingPerson(id);
}
if (shouldHideConfidential(person, util.hasAdmin())) {
throw new ObjectNotFoundException("person not found", "ApiPerson", db, id);
}
if (shouldHideLiving(person, util.hasUser())) {
return createDummyLivingPerson(id);
}
logger.info("entering read person: " + id);
return crud().readOne(db, id);
}
Expand Down

0 comments on commit def23e9

Please sign in to comment.