diff --git a/src/main/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationService.java b/src/main/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationService.java index f3c063cd..820360f4 100644 --- a/src/main/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationService.java +++ b/src/main/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationService.java @@ -56,6 +56,6 @@ public boolean canModify(TermOccurrence occurrence) { @Transactional(readOnly = true) public boolean canModify(URI occurrenceId) { - return dao.find(occurrenceId).map(this::canModify).orElse(false); + return dao.find(occurrenceId).map(this::canModify).orElse(true); } } diff --git a/src/test/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationServiceTest.java b/src/test/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationServiceTest.java index 360f73ff..95bc35da 100644 --- a/src/test/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationServiceTest.java +++ b/src/test/java/cz/cvut/kbss/termit/service/security/authorization/TermOccurrenceAuthorizationServiceTest.java @@ -20,7 +20,6 @@ import java.net.URI; import java.util.Optional; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; @@ -79,8 +78,8 @@ void canModifyResolvesResourceVocabularyAndChecksIfUserCanModifyItWhenTermOccurr } @Test - void canModifyReturnsFalseWhenTermOccurrenceDoesNotExist() { + void canModifyReturnsTrueWhenTermOccurrenceDoesNotExist() { when(toDao.find(any())).thenReturn(Optional.empty()); - assertFalse(sut.canModify(Generator.generateUri())); + assertTrue(sut.canModify(Generator.generateUri())); } }