Skip to content

Commit

Permalink
[Fix] When term occurrence does not exist, let authorization consider…
Browse files Browse the repository at this point in the history
… access to it allowed.
  • Loading branch information
ledsoft committed Dec 10, 2024
1 parent 569a0db commit 44fba54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
}

0 comments on commit 44fba54

Please sign in to comment.