There are a number of safeguards in the Mental Health Act Scotland 2003, for people with a 'mental disorder' and under the Act, to "make sure your rights are protected".
The main ones are the Mental Health Tribunal, named person, advocacy, advance statement, Mental Welfare Commission. In theory these pillars, along with the Principles of the Act, should ensure fair and just treatment for people in mental distress and under detention. In practice it depends on the safeguards having the power and place they are meant to have, in my opinion. (taken from recent blog post 'Mental Health Acts - Protecting Rights or Not?')
As a 'named person' and carer I had limited rights of access to the psychiatric locked ward. Advocacy was difficult to obtain and, in our opinion, not a voice for the locked-up patient. The advance statement required more content to be taken seriously. Another 'bulletproof' one has been written. The Mental Health Tribunal seemed to be on the side of the system and not the patient, having little impact on patient safety. As for the Mental Welfare Commission I want to believe it's a watchdog (with teeth) and a guide dog, helping shape policy, develop services and safeguard rights. See MWC 'Influencing & Challenging'.