Fix transferring of webapi decorator information.

The recent code to transfer webapi decorator information across
decorators and to intelligently merge them had a couple issues. The
@webapi_permission_required decorator was overwriting data, causing the
errors it sets to go away, and the code to merge checked some state too
late.
Merge branch 'release-0.7.x'