Fix a couple critical issues in the web API resources code.

Review Request #2003 — Created Dec. 14, 2010 and submitted — Latest diff uploaded




Fix a couple critical issues in the web API resources code.

There were two major issues affecting the Djblets web API code.

First, @augment_method_from was calling the wrong functions in the chain,
meaning that it could skip over some decorators potentially. In Review Board,
this caused @webapi_check_login_required to fail, making resources only
work when logged in. This could break clients.

Second, PERMISSION_DENIED wasn't sufficient for clients not authenticated.
The client wouldn't know that logging in could potentially allow access to
the resource. Now, we return PERMISSION_DENIED if the client is authenticated,
or NOT_LOGGED_IN otherwise.
Tested these along with my Review Board changes (/r/2004) and this fixed
several problems I had with making post-review work correctly with the
new API.

Verified through print statements that the right decorators in the chain
were being called. Also saw the affects of some of them that we weren't
hitting before (which now breaks some Review Board unit tests).

Once these and the Review Board changes are in, I'll probably make a release.