Add filtering for accessible review requests.

Review Request #1932 — Created Nov. 16, 2010 and submitted

Information

Review Board
master

Reviewers

Add filtering for accessible review requests.

When querying review requests, only those that are accessible will now be
returned. This uses the same criteria as that used in
ReviewRequest.is_accessible_by(). The accessibility of the Repository and
the Review Groups will be checked during the query.

In order to embed the queries needed, RepositoryManager.accessible_q and
GroupManager.accessible_q functions have been added. These return a Q() object
that represents the accessibility query checks. They can take a prefix for
the variables so that they can be used with a relation in another query.
The existing accessible() functions now just wrap these queries.

 
GU
  1. 
      
  2. 
      
GU
  1. Test
  2. 
      
david
  1. 
      
  2. reviewboard/reviews/managers.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    So, my change included stuff for this. I'm not really sure what the benefit of accessible_q is here? It just seems more complicated.
    1. We discussed this on IRC, but for the record, this is available so that this queryset can be embedded in other querysets that need to enforce the accessibility restrictions on relations. So, for example, the ReviewRequest queries should only return review requests  whose repositories and groups are accessible by the user. Rather than duplicating all that logic (which could potentially become stale), we thunk out to this.
      
      It's more or less doing to Q()'s what we do to QuerySets. I'd love it if we could instead do something like Q(repository__accessible=True) and have it somehow let us handle what that accessible= logic does, but this is the closest we can do.
  3. reviewboard/scmtools/managers.py (Diff revision 1)
     
     
    Same comment here as with the ReviewGroupManager.
  4. 
      
chipx86
Review request changed
david
  1. 
      
  2. 
      
Loading...