So any dispensary would have addiction specialists on hand, anyone getting heroin would have a card and a database. "Casual" and light users would pay, a known hard-case addict with limited means would get it subsidized or free.
The goal is primarily to kick the bottom out of the black market, with a close second being keeping addicts healthy and alive, where quitting heroin is the best case scenario.
One of my nieces died from heart failure last year. She had been living on the street and been a hard core drug user. I can't say that it was heroin that killed her, because like most street users, she took anything she could get her hands on. But her heroin addiction was what kept her on the street. She had been through treatment more times than I can count. None helped for very long. In the end, she's dead at 29, a life completely wasted.
Would legalized heroin with clean needles have saved her? Don't know. But our current system sure didn't.
Cigarettes are even more addictive, and yet we aren't freaking out and throwing cigarette smokers in jail.