R (SSHD) v MHRT, re PH  EWCA Civ 1868
Conditions of discharge are lawful so long as they do not amount to a deprivation of liberty: in this case, a condition that the patient could not leave a hostel unescorted was lawful; so too could be a condition of residence at a hospital (rough summary)
In this case, unusually restrictive conditions were imposed primarily for the benefit of PH (who was frail, elderly and very institutionalised) rather than for the protection of the public. One of these was that PH was to be escorted whenever he left the hostel.
The extent to which the Tribunal can impose unusually restrictive conditions was clarified in the case of R (SSHD) v MHRT, re MP (2004) EWHC 2194. MP had been granted a deferred conditional discharge, which included the condition that he was not to be allowed out of the hostel without an escort. This was because of the risk MP posed to the public. The court held that this inevitably amounted to a deprivation of liberty.