 It is prohibited all the time according to the Maliki madhhab.At the same, there is a minority opinion within the Maliki school that allows masturbation if done in private and without the use of illicit materials such as pornography and drugs.It is prohibited all the time according to the Shafi`i madhhab.