update for test issue
This commit is contained in:
parent
f2742ce0e0
commit
70ae49e28d
|
@ -15,7 +15,6 @@ import org.apache.jackrabbit.api.security.user.Group;
|
|||
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
|
||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||
import org.gcube.common.storagehub.model.Excludes;
|
||||
import org.gcube.common.storagehub.model.Paths;
|
||||
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||
import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
|
||||
import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters;
|
||||
|
@ -128,8 +127,9 @@ public class AuthorizationChecker {
|
|||
if (Constants.WRITE_PROTECTED_FOLDER.contains(item.getName()) || Constants.WRITE_PROTECTED_FOLDER.contains(item.getTitle()))
|
||||
throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to write into node with id "+item.getId()+": it's a protected folder");
|
||||
|
||||
/*
|
||||
if (item.isTrashed())
|
||||
throw new UserNotAuthorizedException("Trashed item cannot be written");
|
||||
throw new UserNotAuthorizedException("Trashed item cannot be written");*/
|
||||
|
||||
if (item.isShared()) {
|
||||
Node parentSharedNode = retrieveSharedFolderParent(node, session);
|
||||
|
|
|
@ -121,7 +121,7 @@ public class ItemsManager {
|
|||
@Inject Item2NodeConverter item2Node;
|
||||
|
||||
@Inject StorageBackendHandler storageBackend;
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
@ -150,7 +150,7 @@ public class ItemsManager {
|
|||
|
||||
return new ItemWrapper<Item>(toReturn);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/path")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
@ -161,13 +161,13 @@ public class ItemsManager {
|
|||
try{
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
authChecker.checkReadAuthorizationControl(ses, id);
|
||||
|
||||
|
||||
String relativePath = path.startsWith("/")? path.substring(1) : path;
|
||||
if (path.endsWith("/"))
|
||||
relativePath.substring(0,relativePath.lastIndexOf("/"));
|
||||
|
||||
|
||||
if (relativePath.isEmpty()) throw new InvalidCallParameters("empty path");
|
||||
|
||||
|
||||
Item item =null;
|
||||
String nextId = id;
|
||||
String[] paths = relativePath.split("/");
|
||||
|
@ -177,7 +177,7 @@ public class ItemsManager {
|
|||
authChecker.checkReadAuthorizationControl(ses, item.getId());
|
||||
nextId = item.getId();
|
||||
}
|
||||
|
||||
|
||||
if (excludes.containsAll(Excludes.ALL))
|
||||
return new ItemWrapper<Item>(item);
|
||||
else
|
||||
|
@ -195,9 +195,9 @@ public class ItemsManager {
|
|||
|
||||
return new ItemWrapper<Item>(toReturn);
|
||||
}
|
||||
|
||||
|
||||
private Item getChildrenMatchingName(Session ses, String id, String name, List<String> excludes) throws ItemNotFoundException , RepositoryException, StorageHubException {
|
||||
|
||||
|
||||
NodeIterator it = ses.getNodeByIdentifier(id).getNodes();
|
||||
while (it.hasNext()) {
|
||||
Node child= it.nextNode();
|
||||
|
@ -211,7 +211,7 @@ public class ItemsManager {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/items/{name}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
@ -342,7 +342,7 @@ public class ItemsManager {
|
|||
|
||||
return new ItemList(toReturn);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/children/paged")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
@ -521,7 +521,7 @@ public class ItemsManager {
|
|||
String filePublicUrl = String.format("%s/%s%s",basepath, enchriptedPrefix, enchriptedString);
|
||||
return filePublicUrl;
|
||||
}
|
||||
|
||||
|
||||
@PUT
|
||||
@Path("{id}/publish")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
@ -539,11 +539,11 @@ public class ItemsManager {
|
|||
|
||||
if (!(folder instanceof FolderItem))
|
||||
throw new InvalidCallParameters("item is not a folder");
|
||||
|
||||
|
||||
currentNode.setProperty(NodeProperty.IS_PUBLIC.toString(), publish);
|
||||
|
||||
|
||||
ses.save();
|
||||
|
||||
|
||||
}catch(RepositoryException re ){
|
||||
log.error("jcr error getting rootSharedFolder", re);
|
||||
GXOutboundErrorResponse.throwException(new BackendGenericError(re));
|
||||
|
@ -874,10 +874,10 @@ public class ItemsManager {
|
|||
if (!(destinationItem instanceof FolderItem))
|
||||
throw new InvalidItemException("destination item is not a folder");
|
||||
|
||||
|
||||
|
||||
boolean movingSharedItemOutside = item.isShared() && (!destinationItem.isShared() || !getSharedParentNode(nodeToMove).getIdentifier().equals(getSharedParentNode(destination).getIdentifier()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
ses.getWorkspace().getLockManager().lock(destination.getPath(), false, true, 0,login);
|
||||
|
@ -891,12 +891,12 @@ public class ItemsManager {
|
|||
|
||||
ses.getWorkspace().move(nodeToMove.getPath(), newPath);
|
||||
Utils.setPropertyOnChangeNode(ses.getNode(newPath), login, ItemAction.MOVED);
|
||||
|
||||
|
||||
String mimeTypeForAccounting = (item instanceof AbstractFileItem)? ((AbstractFileItem) item).getContent().getMimeType(): null;
|
||||
|
||||
|
||||
if (movingSharedItemOutside)
|
||||
item2Node.updateOwnerOnSubTree(nodeToMove, login);
|
||||
|
||||
|
||||
accountingHandler.createFolderAddObj(uniqueName, item.getClass().getSimpleName(), mimeTypeForAccounting , ses, destination, false);
|
||||
accountingHandler.createFolderRemoveObj(item.getTitle(), item.getClass().getSimpleName(), mimeTypeForAccounting, ses, originalParent, false);
|
||||
ses.save();
|
||||
|
@ -1100,7 +1100,7 @@ public class ItemsManager {
|
|||
}
|
||||
return Response.ok(id).build();
|
||||
}
|
||||
|
||||
|
||||
@PUT
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/{id}/metadata")
|
||||
|
@ -1152,7 +1152,7 @@ public class ItemsManager {
|
|||
@Path("{id}")
|
||||
public Response deleteItem(@QueryParam("force") boolean force){
|
||||
InnerMethodName.instance.set("deleteItem("+force+")");
|
||||
|
||||
|
||||
Session ses = null;
|
||||
try{
|
||||
|
||||
|
@ -1160,25 +1160,25 @@ public class ItemsManager {
|
|||
|
||||
//TODO check if it is possible to change all the ACL on a workspace
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
authChecker.checkMoveOpsForProtectedFolders(ses, id);
|
||||
|
||||
authChecker.checkWriteAuthorizationControl(ses, id, false);
|
||||
authChecker.checkMoveOpsForProtectedFolders(ses, id);
|
||||
|
||||
final Node nodeToDelete = ses.getNodeByIdentifier(id);
|
||||
|
||||
Item itemToDelete = node2Item.getItem(nodeToDelete, Excludes.GET_ONLY_CONTENT);
|
||||
|
||||
|
||||
if (itemToDelete instanceof SharedFolder || itemToDelete instanceof VreFolder || (itemToDelete instanceof FolderItem && Utils.hasSharedChildren(nodeToDelete)))
|
||||
throw new InvalidItemException("SharedFolder, VreFolder or folders with shared children cannot be deleted");
|
||||
|
||||
log.debug("item is trashed? {}", itemToDelete.isTrashed());
|
||||
|
||||
if (!itemToDelete.isTrashed() && !force)
|
||||
if (!itemToDelete.isTrashed() && !force) {
|
||||
trashHandler.moveToTrash(ses, nodeToDelete, itemToDelete);
|
||||
else
|
||||
}else
|
||||
trashHandler.removeNodes(ses, Collections.singletonList(itemToDelete));
|
||||
|
||||
}catch (LockException e) {
|
||||
|
||||
|
||||
}catch(RepositoryException re ){
|
||||
log.error("jcr error moving item", re);
|
||||
GXOutboundErrorResponse.throwException(new BackendGenericError(re));
|
||||
|
|
|
@ -25,7 +25,7 @@ The projects leading to this software have received funding from a series of
|
|||
Version
|
||||
--------------------------------------------------
|
||||
|
||||
1.2.0-SNAPSHOT (2020-04-17)
|
||||
1.2.0-SNAPSHOT (2020-04-23)
|
||||
|
||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||
|
||||
|
|
Loading…
Reference in New Issue