protected boolean isClientAnAuthority() { String careProviderType = idCard.getSystemInfo().getCareProvider().getType(); Preconditions.checkState( CVR_NUMBER.equals(careProviderType), "ID Card Care provider is not a CVR. This is a programming error."); String clientCVR = idCard.getSystemInfo().getCareProvider().getID(); return whitelistService.isCvrWhitelisted(clientCVR, SERVICE_NAME_DGCPR); }
protected boolean isPersonProtected(Person person) { if (person.getNavnebeskyttelsestartdato() == null) return false; // We have to make the guard above to avoid null being passed into the // Instant // it is converted to the beginning of the era. Preconditions.checkState( person.getNavnebeskyttelseslettedato() != null, "The protection end date was not present. This is most unexpected and a programming error."); Instant protectionStart = new Instant(person.getNavnebeskyttelsestartdato()); Instant protectionEnd = new Instant(person.getNavnebeskyttelseslettedato()); return protectionStart.isEqualNow() || (protectionStart.isBeforeNow() && protectionEnd.isAfterNow()); }