Handle saving doc access settings

Add test cases.