It seems like a bug where you can change your username while having a file unlocked, and it will lock you out, and conversely you can change your name to someone else's name and lock a file (and edit it while unlocked).
Maybe this is by design or would be overly complicated to fix and in the backlog because user authentication can be an annoying problem, but thought I'd log it.
Recreation steps - locking self out
- Unlock file as username
example
- Change username to
otherexample
- Return to file
- Unable to edit
Recreation steps - editing other user's files
- Signed in as username
example
and see file locked by usernameotherexample
- Change username to
otherexample
- Return to file
- Can make changes and lock the file as if you are the other user