You can only write to a file after you have opened it. When you open it the permission checks are done. In theory one might argue that for a request for a read-write file descriptor the quota state might be checked but as you need write access to truncate a file and quota should never prevent space from being freed I assume this is not the case.
Thus due to the order of `open()` and `write()` the permission check should always come first.