@Override public boolean isOrder(Context context, WorkspaceItem workspaceItem, Group group) throws SQLException { return workspaceItem.getSupervisorGroups().contains(group); }
@Override public void remove(Context context, WorkspaceItem workspaceItem, Group group) throws SQLException, AuthorizeException { // get the workspace item and the group from the request values workspaceItem.getSupervisorGroups().remove(group); // get the item and have it remove the policies for the group Item item = workspaceItem.getItem(); itemService.removeGroupPolicies(context, item, group); }
@Override public void deleteWrapper(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException { // Check authorisation. We check permissions on the enclosed item. Item item = workspaceItem.getItem(); authorizeService.authorizeAction(context, item, Constants.WRITE); log.info(LogManager.getHeader(context, "delete_workspace_item", "workspace_item_id=" + workspaceItem.getID() + "item_id=" + item.getID() + "collection_id=" + workspaceItem.getCollection().getID())); // deleteSubmitPermissions(); // Need to delete the workspaceitem row first since it refers // to item ID workspaceItem.getSupervisorGroups().clear(); workspaceItemDAO.delete(context, workspaceItem); }
@Override public void deleteAll(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException, IOException { /* * Authorisation is a special case. The submitter won't have REMOVE * permission on the collection, so our policy is this: Only the * original submitter or an administrator can delete a workspace item. */ Item item = workspaceItem.getItem(); if (!authorizeService.isAdmin(context) && ((context.getCurrentUser() == null) || (context .getCurrentUser().getID() != item.getSubmitter() .getID()))) { // Not an admit, not the submitter throw new AuthorizeException("Must be an administrator or the " + "original submitter to delete a workspace item"); } log.info(LogManager.getHeader(context, "delete_workspace_item", "workspace_item_id=" + workspaceItem.getID() + "item_id=" + item.getID() + "collection_id=" + workspaceItem.getCollection().getID())); // Need to delete the epersongroup2workspaceitem row first since it refers // to workspaceitem ID workspaceItem.getSupervisorGroups().clear(); // Need to delete the workspaceitem row first since it refers // to item ID workspaceItemDAO.delete(context, workspaceItem); // Delete item itemService.delete(context, item); }
workspaceItem.getSupervisorGroups().add(group); group.getSupervisedItems().add(workspaceItem);