How to block certain extensions from calling certain extensions at night

I just installed FreePBX 17 at a boarding school.

We need to block the boys dorm room extensions from calling the girls room extensions (and vice versa) after a certain time at night… (but of course the the STAFF may need to be able to call all extensions at any time, and the students should be able to call staff or even make external calls any time)

I’m looking for help to set this up…

Additional info - the dorm extensions are analog phones connected via grandstream GXW4232 gateways. (boys and girls dorms each have their own GXW4232 gateways)