Logical-AND category permissions?

I assume this requires a plugin or script via the API? It’s too much to do manually.