User can unlock file locked by other user in shared folders
Scenario: User A creates a shared directory. User B creates a file in that directory and locks the file User A tries to unlock that file.
What happens: The file gets unlocked without errors.
What should happen / is expected: The file stays locked and the server returns 403. Because the lock is owned by user B.
Why does this happen The initial test if the owner of the lock and the current user are the same, fails :heavy_check_mark: https://github.com/nextcloud/files_lock/blob/7b1827af32b848b6ed25bcefc17696b9260a61f8/lib/Service/LockService.php#L244
But then the next check allows to unlock, because the file is created inside the shared directory it is owned implicitly by the sharing user, and we allow file owners always to unlock: https://github.com/nextcloud/files_lock/blob/7b1827af32b848b6ed25bcefc17696b9260a61f8/lib/Service/LockService.php#L248
I am not sure if this is a feature or a bug. So probably two solutions here:
- Allow configure whether file owners are allowed to always unlock
- Document that file owners always can unlock their files and note that files in shared folders are always owned by the folder owner.
was introduced here https://github.com/nextcloud/files_lock/pull/140
hello
We have some trouble I thinks related as explained at https://github.com/nextcloud/files_lock/issues/170#issuecomment-1868337420