What is appropriate usage of medicines that are intoxicating? What is appropriate usage of medicines that are intoxicating?

I know that cannabis has been used for pain relief but if the use of the cannabis is intoxicating then what is the right view of what is appropriate regarding the use of the cannabis as a medicine? 

Are there any suttas which seem like they might be helpful in answering this question?
My impression is medical cannabis does not have an intoxicating effect.  

Regardless, the precept on intoxicants refers to heedlessness. If a person has a serious medical condition and must use ordinary intoxicating cannabis for relief then it is expected they would be morally mature enough for the cannabis to not lead to heedlessness.