-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement persistent locking #382
Conversation
be8ddc7
to
4ba27a7
Compare
To be included in the 10.12.0 server release. https://github.com/owncloud/enterprise/issues/5545 |
4ba27a7
to
c730269
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only found one scenario that does not work as I would expect:
- Alice creates a text file t.txt
- Alice shares t.txt read-write with Brian
- Alice locks t.txt
- Brian opens t.txt, he gets the editor in read-only mode, it says that the file is locked by Alice - good
- Alice opens t.txt
The editor opens in read-only mode.
Alice cannot edit t.txt - bad
The checks for a locked file need to understand if the lock owner is the current user.
@phil-davis I do not agree. Text Editor aApp really works like you would upload a file. Can you try uploading a file via UI and see the outcome in the above scenario? If this would be collaborative it would be different. |
OK, well I don't understand the use-case for Alice to lock a file. But as you say, if Alice locks the file and then Alice tries to upload-overwrite the file, then the upload is blocked. So this is an existing behavior. |
Long story short:
|
💥 Acceptance tests pipeline webUITextEditor-master-chrome-mariadb10.2-php7.4 failed. The build has been cancelled. https://drone.owncloud.com/owncloud/files_texteditor/1945/12 |
@DeepDiver1975 please review again. |
I tend to agree with Phil: A manual lock would be most useful, if the user who locked the file, can still upload the file. https://doc.owncloud.com/server/next/admin_manual/configuration/files/manual_file_locking.html#introduction says: @hodyroff But this is a broader topic. Currently (10.11) the owner cannot overwrite a file by uploading, while locked. |
@jnweiger it is more complex then this. Apps can set their own locks, like Wopi/MSOFFICE. Even if you own the file, you SHOULD NOT be able to break that lock by just overwriting a file that is in collaborative session. You would need to click on "release lock button" first to be able do that. However if file is in collaborative session, and you break the lock.. ye it asks for problems as work in progress in MSOFFICE app could be lost.. |
The ability to break a lock comes with responsibilities. Yes, works as designed. If locked, no upload shall be possible. Unlock and then you can overwrite ... which also means you can then wait to see if any desktop clients will do their scheduled work after unlock ... |
Argh, I did not want to sidetrack here. Made a separate issue meanwhile. Hmm, I did not expect that 'manual locking' is the same as app locking. Sure thing: wopi or text editor should do their own locking to prevent oven the same user to mess with the file, while the editor is open. |
@jnweiger I agree, manual lock is a disputable matter. But how do I distinguish manual lock from wopi lock? this would require me to embeed logic from other apps into this one 😉 |
It must be the same, there is only one WebDAV lock ... which is also adhered to by all WebDAV Clients, not only the ownCloud once! |
cf83eb1
to
f70bbdc
Compare
@DeepDiver1975 @phil-davis locking is now implemented, description adjusted. |
It works for me. The only hassle is if a do:
Now the file is left locked by Brian. It will be stuck like that until the lock times out, or a user with the priv to delete locks does delete the lock. Alice cannot edit the file. And Brain won't realize what he has done, because the files_texteditor app took out the lock on behalf of Brian. Brian did not click anything to lock the file. So Brian is not likely to even be aware that he has a lock on the fie. But I think that these kind of user sequences are beyond the scope of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - manually testing with multiple users editing and viewing the file works as advertised.
It won't be so easy to make automate UI tests for those sequences, because it requires having multiple users logged in at the same time.
Yes, expected. Thats what we have the "lockbreaker group" for and by default a timeout at midnight or so ... |
It is possible to block closing a tab and notify the user that the text editor needs to be closed/saved. |
It looks reasonably possible to implement. @mrow4a are you going to add that? |
@DeepDiver1975 added logic to block closing windows (requesting confirmation) when editor is not closed. This does not much prevent the issue, but user maybe needs to think twice, so definitely better than nothing. @phil-davis so:
|
I pushed an adjustment to the failing test so that it waits and checks the editor autosave, rather than doing a reload of the page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Kudos, SonarCloud Quality Gate passed! |
@DeepDiver1975 please review. IMO this is good to merge. |
Can we have this merged if considered to be ok? |
looks good -> merge |
Confirmed fixed in 2.5.0-rc.1 -> Details see #384 (comment) Confirmed fixed with core bundle 10.12.0-rc.3 |
fixes: https://github.com/owncloud/enterprise/issues/5515
This PR makes sure the below scenario is working
Additionally, it implements locking mechanism for text editor.
DEMO
alice shares with:
alice starts editing the file
carol can see that alice locked a file
when alice finishes the lock is gone (editor is closed)
brian has only read-only permissions, so can only check contents and message is shown to him