Publishing a Corpus
@anoe would like to support a new feature in Gargantext, namely "publishing" a corpus.
By publishing we really mean enabling the user to share a corpus into the public folder, for the whole world to see.
Requirements
- Requesting to publish a node should create a read only copy of it into the
Public
folder; any user (including not-logged-in users) will be able to access this node in the tree, but they won't be able to modify it; - At least initially, we don't need changes to the initial corpus to be reflected back to the published corpus, it's a "one off" operation. In other terms, publishing involves ending up with a "snapshot" of a corpus at the time of the publishing;
- At least in the beginning, we probably only want the data (docs and terms), the graph(s), and the phylo to be published. Probably some thinking will need to happen about what to do if the graphs and the phylo are not present before publishing (maybe we ask the publisher to generate them ahead of time before proceeding?)
Technical aspects
In technical terms, we already have some Haskell functions in the backend to copy/clone nodes (that @glocqueville ) already implemented. Roughly speaking, we would need (if we don't have already) to extend the properties of a node to make it read-only / immutable, which means that any modifications on a node is rejected (either via the REST than from the GQL API). The access policy we added at the servant level should already allow any (even unauthenticated) access to public endpoints, so that shouldn't be a problem (but needs to be tested).
This will probably require a new endpoint, because it's better to be explicit about the behaviour -- we probably want to distinguish the simple act of moving a corpus node (as in dragging from A to B) from the act of publishing (in read-only mode).