People Need to Collaborate…
You have probably encountered this situation: people need to collaborate on a document. Yet, they do not have access to each others space for security or confidentiality matters. You haven’t? Then you should read this blog post too! This is bound to happen to you at some point.
…so Why Should We Restrain Them?
In such a situation, we often see some (bad) solutions:
- Create a specific space for these users: It’s hard to keep track of what has been done, and to maintain. It also forces them to create a structure that has no other particular reason to exist.
- Give access to the whole space where the document is located: If access was not granted in the first place, there was a reason for that.
- Create several copies and merging them manually: Collaborating shouldn’t be that difficult.
A Shortcut, You Say?
Shortcuts in the Nuxeo Platform are also called proxies. They can point to an archived version of a document, or to the document’s current version (in this case, we call it a live proxy).
How Does a Live Proxy Work?
- Whenever you edit the original document or the proxy live, both are modified at the same time.
- A live proxy inherits the access rights of the space where it is currently located. It doesn’t take into account the rights of the original document’s space. That allows people with access to different spaces to work together, and that’s the whole point of this post.
- If the live proxy is deleted, it has no impact on the original document.
How Do I Implement That?
We will use a workflow to ask your user where they want to have a live proxy created, from a predefined options list. The result in Studio is the following:
Looks easy, right? On to the recipe now!
Define Where the Proxy Can Be Created
We will start by creating the options list for the proxy creation.
- In Nuxeo Studio, add a new vocabulary.
- Choose “simple vocabulary”. In this example, I named it “spaces”.
When you add entries:
- In the id: put a relative or absolute path. This will point to the space where the proxy can be created. In the capture below I put a relative path starting from the domain.
- In the label, type what the user should see in his options list.
We are using a vocabulary to achieve this for two reasons:
- If we provided the user with a document suggestion, he would only see spaces where he has access to.
- It gives us better control over what we want to display.
Create Your Workflow
- In Nuxeo Studio, create a new workflow and name it.
- In the variables tab, add a String variable named destination. This will store the user’s choice.
- In the availability tab, define when you should be able to use your workflow. Make sure you choose “Current document is: Regular Document“ to avoid people launching the workflow on a proxy. For more details, have a look at the filtering options reference page.
- In the graph tab, drag and drop a “start” node, a “stop” node, and an “approve” node from the node library on your left. Link them together. Your setup should look like this:
Setup the User’s Choice
- Hover your mouse on the “approve” node and edit it.
- Go to the form tab.
- In the drop down list on your right, choose your workflow variables (var_yourWorkflowId).
- Drag and drop the “destination” variable to the form in the middle of the screen.
- A popup will appear to let you choose the display properties.
- Use a single directory suggestion widget, and use your “spaces” vocabulary. You can also setup the “minimum characters” property to 0.
- Make sure you save these properties before continuing.
Implement the Business Logic
- In the node’s “general” tab, you can setup the properties as follows: As you can see, I am using an automation chain in the node’s output to create the shortcut. Click on the Create button to add it, and don’t worry: this will save your workflow automatically.
- You can build your chain as follows: The destination path for my live proxy is based on the current domain’s path, to which I add the user chosen option. You could build it differently of course.
Try It Out
You are all done! Now deploy your changes and try them out:
- In your local Nuxeo instance, go to the admin center.
- Choose the update center menu on the left.
- Click on the “Nuxeo Studio” tab, then on the “update” button.
- And this is the final result:
My next post will explain how to delegate temporary access to a document. See you soon!