minor fix

This commit is contained in:
Mykhaylo
2021-04-20 11:33:11 +02:00
parent 4acdc4fb9f
commit d4493b24d0
2 changed files with 6 additions and 8 deletions

View File

@@ -66,17 +66,15 @@ public class CanManageMappingsFeature implements AuthorizationFeature {
}
if (object instanceof ItemRest) {
Item item = itemService.find(context, UUID.fromString(((ItemRest) object).getUuid()));
Collection parentCollection = item.getCollections().get(0);
List<Collection> collections = null;
try {
collections = collectionService.findCollectionsWithSubmit("", context, null, 0, 2)
.stream()
.filter(c -> !c.getID().equals(parentCollection.getID()))
.collect(Collectors.toList());
List<Collection> collections = collectionService.findCollectionsWithSubmit("", context, null, 0, 2)
.stream()
.filter(c -> !c.getID().equals(item.getOwningCollection().getID()))
.collect(Collectors.toList());
return CollectionUtils.isNotEmpty(collections);
} catch (SearchServiceException e) {
throw new RuntimeException(e.getMessage(), e);
}
return CollectionUtils.isNotEmpty(collections);
}
return false;
}

View File

@@ -28,7 +28,7 @@ import org.springframework.stereotype.Component;
*/
@Component
@AuthorizationFeatureDocumentation(name = CanManageRelationshipsFeature.NAME,
description = "It can be used to verify if the user has WRITE permission on the Item")
description = "It can be used to verify if the user has permissions to manage relationships of the Item")
public class CanManageRelationshipsFeature implements AuthorizationFeature {
public static final String NAME = "canManageRelationships";