w2p-80200 Add new tests for each dspace object, cleaned up java docs and authrorization inside of create

This commit is contained in:
Nathan Buckingham
2021-08-30 14:38:25 -04:00
parent cdeb22ed7b
commit e1f798fd82
9 changed files with 95 additions and 9 deletions

View File

@@ -176,6 +176,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
@Override
public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException {
authorizeService.authorizeAction(context, workspaceItem.getCollection(), Constants.ADD);
if (workspaceItem.getItem() != null) {
throw new IllegalArgumentException(
"Attempting to create an item for a workspace item that already contains an item");
@@ -193,6 +194,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
@Override
public Item create(Context context, WorkspaceItem workspaceItem,
UUID uuid) throws SQLException, AuthorizeException {
authorizeService.authorizeAction(context, workspaceItem.getCollection(), Constants.ADD);
if (workspaceItem.getItem() != null) {
throw new IllegalArgumentException(
"Attempting to create an item for a workspace item that already contains an item");