This commit is contained in:
Lucio Lelii 2019-01-21 10:19:04 +00:00
parent 042ecafe50
commit 29f8a0d30e
1 changed files with 8 additions and 4 deletions

View File

@ -105,6 +105,14 @@ public class WorkspaceManager {
try{
long start = System.currentTimeMillis();
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
//TODO: remove it when users will be created via storageHub
String user = AuthorizationProvider.instance.get().getClient().getId();
org.gcube.common.storagehub.model.Path trashPath = Paths.append(Utils.getWorkspacePath(), Constants.TRASH_ROOT_FOLDER_NAME);
if (!ses.nodeExists(trashPath.toPath())) {
Utils.createFolderInternally(ses, ses.getNode(Utils.getWorkspacePath().toPath()) , Constants.TRASH_ROOT_FOLDER_NAME, "trash of "+user, false, user, null);
}
log.trace("time to connect to repo {}",(System.currentTimeMillis()-start));
Node node = ses.getNode(absolutePath.toPath());
authChecker.checkReadAuthorizationControl(ses, node.getIdentifier());
@ -215,10 +223,6 @@ public class WorkspaceManager {
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
log.info("time to connect to repo {}",(System.currentTimeMillis()-start));
if (!ses.nodeExists(trashPath.toPath())) {
Utils.createFolderInternally(ses, ses.getNode(Utils.getWorkspacePath().toPath()) , Constants.TRASH_ROOT_FOLDER_NAME, "trash of "+user, false, user, null);
}
Node folder = ses.getNode(trashPath.toPath());
item = node2Item.getItem(folder, excludes);
}catch(RepositoryException re ){