Permissions:  fix restoring subdirectories

The sync item vector must be sorted before we call checkForPermission
Permissions: When moving is not allowed, fallback to delete and upload

We decided that we never want to rename a directory behind the
back of the user as the user may be using files in the directory
during the sync.
If moving is not allowed, we just erase the inode form the database so
the next sync will try to do an upload and delete and recover from there
using normal resolution.

This also add some code to update the inode back to the db when it is detected
as changed.