Check for user write permission and store in db