@Test(expected = WebCertServiceException.class) public void testVerifyEnhetsAuthFail() { when(webCertUserService.isAuthorizedForUnit(anyString(), any(Boolean.class))).thenReturn(false); service.verifyEnhetsAuth("<doesnt-exist>"); }
protected void verifyEnhetsAuth(String enhetsId) { if (!webCertUserService.isAuthorizedForUnit(enhetsId, false)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, "User not authorized for for enhet " + enhetsId); } }
FragaSvarServiceImpl implements FragaSvarService { protected void verifyEnhetsAuth(String enhetsId) { if (!webCertUserService.isAuthorizedForUnit(enhetsId, false)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, "User not authorized for for enhet " + enhetsId); } } }
FragaSvarServiceImpl implements FragaSvarService { protected void verifyEnhetsAuth(String enhetsId) { if (!webCertUserService.isAuthorizedForUnit(enhetsId, false)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, "User not authorized for for enhet " + enhetsId); } }  }
FragaSvarServiceImpl implements FragaSvarService { protected void verifyEnhetsAuth(String enhetsId) { if (!webCertUserService.isAuthorizedForUnit(enhetsId, false)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, "User not authorized for for enhet " + enhetsId); } }  @Override FragaSvar processIncomingQuestion(FragaSvar fragaSvar); @Override FragaSvar processIncomingAnswer(Long internId, String svarsText, LocalDateTime svarSigneringsDatum); @Override @Transactional(readOnly = true) List<FragaSvarView> getFragaSvar(String intygId); @Override FragaSvar saveSvar(Long fragaSvarsId, String svarsText); @Override List<FragaSvarView> answerKomplettering(final String intygsId, final String svarsText); @Override FragaSvar saveNewQuestion(String intygId, String typ, Amne amne, String frageText); @Override List<FragaSvar> setVidareBefordrad(final String intygsId); @Override FragaSvar closeQuestionAsHandled(Long frageSvarId); @Override void closeCompletionsAsHandled(String intygId); @Override void closeAllNonClosedQuestions(String intygsId); @Override FragaSvar openQuestionAsUnhandled(Long frageSvarId); @Override @Transactional(readOnly = true) QueryFragaSvarResponse filterFragaSvar(Filter filter); @Override @Transactional(readOnly = true) List<Lakare> getFragaSvarHsaIdByEnhet(String enhetsId); @Override Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper); }
FragaSvarServiceImpl implements FragaSvarService { protected void verifyEnhetsAuth(String enhetsId) { if (!webCertUserService.isAuthorizedForUnit(enhetsId, false)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, "User not authorized for for enhet " + enhetsId); } }  @Override FragaSvar processIncomingQuestion(FragaSvar fragaSvar); @Override FragaSvar processIncomingAnswer(Long internId, String svarsText, LocalDateTime svarSigneringsDatum); @Override @Transactional(readOnly = true) List<FragaSvarView> getFragaSvar(String intygId); @Override FragaSvar saveSvar(Long fragaSvarsId, String svarsText); @Override List<FragaSvarView> answerKomplettering(final String intygsId, final String svarsText); @Override FragaSvar saveNewQuestion(String intygId, String typ, Amne amne, String frageText); @Override List<FragaSvar> setVidareBefordrad(final String intygsId); @Override FragaSvar closeQuestionAsHandled(Long frageSvarId); @Override void closeCompletionsAsHandled(String intygId); @Override void closeAllNonClosedQuestions(String intygsId); @Override FragaSvar openQuestionAsUnhandled(Long frageSvarId); @Override @Transactional(readOnly = true) QueryFragaSvarResponse filterFragaSvar(Filter filter); @Override @Transactional(readOnly = true) List<Lakare> getFragaSvarHsaIdByEnhet(String enhetsId); @Override Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper);  }