David Kaminski-Morrow, air transport editor of Flightglobal, said that normally a locked cockpit door could be opened with a code.
“But inside there is a simple switch on the control panel the pilot would turn to lock the door,” he said.
He cited the crash of a Mozambican Airlines flight in Namibia in 2013 in which the pilot is believed to have locked himself in the cockpit and put the plane into a nose dive.
http://www.bbc.co.uk/news/world-europe-32062278
lemonde says it was the pilot in the cockpit, the copilot was locked out