Prosecutors said Gbenga Afolabi, of Avon, used his position of authority to have sex with inmates under his supervision.