Nikolay
Nikolay

Reputation: 12245

Disable simultaneous document editing (when implementing a WOPI server)

I have a WOPI server, implemented more or less according to http://wopi.readthedocs.io/ (without "cobalt", i.e. using the 2016 version of office online)

The problem: two users can open the same document at the same time for editing.

How do I prevent that from happening? I've checked the docs. There was a flag "supportsCoAuthoring", but it's not there anymore, and anyways it's set to false. I don't want support co-authoring.

I thought that office online has an in-built support for that, so that it will not allow 2 people to edit the same document at the same time (i.e. if the server "Lock" returns 409, "conflict"). But this does not seem to be the case - my file opens for editing for both users now just fine, even if there is a lock conflict! And the last who saves wins. Am I missing something..?

If we have 2 users, say, A, and B, then when B opens document for editing (already opened by A), then A gets a nice popup "User B also started editing this document". I don't want that. Instead I want B to be not able to open the document for editing.

Should locks be implemented separately instead (purely by the server)?

The code is based on https://github.com/apulliam/WOPIFramework (without sql part though, as I don't need/have any sql)

Upvotes: 1

Views: 673

Answers (1)

rocky
rocky

Reputation: 7696

You have to implement not only the Lock-related operations on the WOPI server but also all the related responses.

E.g. when you implement PutFile:

If the file is currently locked and the X-WOPI-Lock value does not match the lock currently on the file the host must return a “lock mismatch” response (409 Conflict) and include an X-WOPI-Lock response header containing the value of the current lock on the file. In the case where the file is unlocked, the host must set X-WOPI-Lock to the empty string.

See the documentation here and here.

Upvotes: 0

Related Questions