Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ public boolean isAuthorized(Context context, BaseObjectRest object) throws SQLEx
}
if (object instanceof ItemRest) {
Item item = itemService.find(context, UUID.fromString(((ItemRest) object).getUuid()));
if (!authorizeService.authorizeActionBoolean(context, item, Constants.WRITE)) {
if (item == null || !authorizeService.authorizeActionBoolean(context, item, Constants.WRITE)) {
return false;
}
// An orphaned item (e.g. one whose owning collection was lost) has no owning collection.
// Guard against it so the feature evaluation does not throw a NullPointerException.
Comment on lines +67 to +71
Collection owningCollection = item.getOwningCollection();
try {
Optional<Collection> collections = collectionService.findCollectionsWithSubmit(StringUtils.EMPTY,
context, null, 0, Integer.MAX_VALUE)
.stream()
.filter(c -> !c.getID().equals(item.getOwningCollection().getID()))
.filter(c -> owningCollection == null
|| !c.getID().equals(owningCollection.getID()))
.filter(c -> {
try {
return collectionService.canEditBoolean(context, c);
Expand Down
Loading