The crew have a legal duty to prevent pax from boarding whilst intoxicated or from becoming drunk onboard. Monitoring alcohol consumption is the only way to prevent the latter, therefore it is a condition of carriage. It is not actually illegal to drink your own alcohol onboard, but breaks your condition of carriage if you refuse to stop drinking it when requested to do so by the crew. Crew have the right to remove alcohol from pax, provided it is on the understanding that it will be returned at the end of the flight.