My guess is that would be illegal. Fire egress and all that pesky safety stuff y'know...
Yeah, it would definitely have to be interconnected with the fire alarm. It is possible to do restricted exit legally in some situations (for instance costco has all fire doors locked and alarmed, pushing on the crash bar sets off the alarm and the door unlocks in 15 seconds or so).