writing field permissions to code