From a5b9d7f420ad314c9323a99ec5dfdec91499ee6b Mon Sep 17 00:00:00 2001 From: George Nash Date: Mon, 7 Aug 2023 15:08:09 +0100 Subject: [PATCH] removed user access check for updating member language --- .../service/member/services/MemberService.java | 2 -- .../service/member/services/MemberServiceTest.java | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/member-service/src/main/java/org/orcid/memberportal/service/member/services/MemberService.java b/member-service/src/main/java/org/orcid/memberportal/service/member/services/MemberService.java index 8bcf6c22e..f61cb203c 100644 --- a/member-service/src/main/java/org/orcid/memberportal/service/member/services/MemberService.java +++ b/member-service/src/main/java/org/orcid/memberportal/service/member/services/MemberService.java @@ -315,8 +315,6 @@ public MemberOrgIds getCurrentMemberOrgIds(String salesforceId) throws Unauthori } public void updateMemberDefaultLanguage(String salesforceId, String language) throws UnauthorizedMemberAccessException { - LOG.info("Logged in user is {}, language is {}", userService.getLoggedInUser().getEmail()); - validateUserAccess(salesforceId); Optional optional = memberRepository.findBySalesforceId(salesforceId); if (optional.isPresent()) { Member member = optional.get(); diff --git a/member-service/src/test/java/org/orcid/memberportal/service/member/services/MemberServiceTest.java b/member-service/src/test/java/org/orcid/memberportal/service/member/services/MemberServiceTest.java index 3a166baea..91be02f26 100644 --- a/member-service/src/test/java/org/orcid/memberportal/service/member/services/MemberServiceTest.java +++ b/member-service/src/test/java/org/orcid/memberportal/service/member/services/MemberServiceTest.java @@ -696,17 +696,6 @@ void testUpdateMemberDefaultLanguage() throws UnauthorizedMemberAccessException assertThat(captured.getDefaultLanguage()).isEqualTo("en"); } - @Test - void testUpdateMemberDefaultLanguage_illegalAccess() { - Member member = getMember(); - Mockito.when(memberRepository.findBySalesforceId(Mockito.eq("wrongSalesforceId"))).thenReturn(Optional.of(member)); - - Assertions.assertThrows(UnauthorizedMemberAccessException.class, () -> { - memberService.updateMemberDefaultLanguage("wrongSalesforceId", "en"); - }); - Mockito.verify(memberRepository, Mockito.never()).save(Mockito.any(Member.class)); - } - @Test void testProcessMemberContact_add() throws UnauthorizedMemberAccessException { Mockito.doNothing().when(mailService).sendUpdateContactEmail(Mockito.any(MemberContactUpdate.class));