|
|
|
@ -432,6 +432,42 @@ public class ItemsManager {
|
|
|
|
|
String filePublicUrl = String.format("%s/%s%s",basepath, enchriptedPrefix, enchriptedString);
|
|
|
|
|
return filePublicUrl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PUT
|
|
|
|
|
@Path("{id}/publish")
|
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
|
public String makeFolderPublic(@FormParam("publish") boolean publish){
|
|
|
|
|
InnerMethodName.instance.set("makeFolderPublic("+publish+")");
|
|
|
|
|
Session ses = null;
|
|
|
|
|
Item folder= null;
|
|
|
|
|
try{
|
|
|
|
|
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
|
|
|
|
authChecker.checkWriteAuthorizationControl(ses, id, false);
|
|
|
|
|
Node currentNode =ses.getNodeByIdentifier(id);
|
|
|
|
|
log.trace("current node is {}",currentNode.getPath());
|
|
|
|
|
|
|
|
|
|
folder = node2Item.getItem(currentNode, Excludes.ALL);
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
}catch(StorageHubException she ){
|
|
|
|
|
log.error(she.getErrorMessage(), she);
|
|
|
|
|
GXOutboundErrorResponse.throwException(she, Response.Status.fromStatusCode(she.getStatus()));
|
|
|
|
|
}finally{
|
|
|
|
|
if (ses!=null)
|
|
|
|
|
ses.logout();
|
|
|
|
|
}
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
|
@Path("{id}/rootSharedFolder")
|
|
|
|
|