Allow auth backends to act on a user-list query before it's executed.

Review Request #5521 — Created Feb. 21, 2014 and submitted

Information

Review Board
master

Reviewers

Added an overrideable function to AuthBackend which is called at the beginning of UserResource.get_query_set(), which in turn is called by the GET /users/ WebAPI call. The default function does nothing. This allows backends to add their own logic to fetch users from an external source and add them to the local user database (or update existing users) before the db query is executed.

I added docs and fixed the doc for another AuthBackend overrideable function while I was there.

All tests pass aside from a few VCS-dependent ones, which are skipped.

Description From Last Updated

Can you instead say: "This function is executed when querying :ref:webapi2.0-user-list-resource, before retrieving the list of users from the database."

chipx86chipx86

"when the User List web API resource is called" We avoid referring to hard-coded paths in the API generally.

chipx86chipx86

"web API"

chipx86chipx86

"users", not "user"

chipx86chipx86
chipx86
  1. Looks good. Just a couple of docs issues.

  2. docs/manual/extending/auth-backends.rst (Diff revision 1)
     
     
    Show all issues

    Can you instead say:

    "This function is executed when querying :ref:webapi2.0-user-list-resource, before retrieving the list of users from the database."

  3. reviewboard/accounts/backends.py (Diff revision 1)
     
     
    Show all issues

    "when the User List web API resource is called"

    We avoid referring to hard-coded paths in the API generally.

  4. reviewboard/accounts/backends.py (Diff revision 1)
     
     
    Show all issues

    "web API"

  5. reviewboard/accounts/backends.py (Diff revision 1)
     
     
    Show all issues

    "users", not "user"

    1. I take it that this is one place where putting a hard-coded path is okay, to clarify what is meant by the "q" argument?

  6. 
      
MC
david
  1. Ship It!

  2. 
      
MC
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (aa89f3b). Thanks!