Add generic view mixins for Local Site, Profile, and Login Required checks.

Review Request #8999 — Created June 6, 2017 and submitted

Information

Review Board
release-3.0.x
94def46...

Reviewers

We have decorators that check if a user has access to a Local Site and
to check if a user must be authenticated to access a particular view
(based on siteconfig settings). When working with generic views, it's a
bit annoying to use those, as it requires creating a dispatch() method
and using method_decorator() with each of the decorators.

This change introduces four new mixins that apply these decorators to the
view, simplifying the view's responsibilities:

  • CheckLocalSiteAccessViewMixin is a convenience around the
    @check_local_site decorator
  • UserProfileRequiredViewMixin is a convenience around the
    @valid_prefs_required decorator, and
  • CheckLoginRequiredViewMixin is a convenience around the
    @check_login_required decorator.
  • LoginRequiredViewMixin is a convenience around the
    @login_required decorator.

These will be used in some view conversion work that's being done
separately.

Tested these in the view work I'm doing.

Unit tests pass.

Description From Last Updated

Module docstring?

daviddavid

Module docstring?

daviddavid
chipx86
david
  1. 
      
  2. reviewboard/accounts/mixins.py (Diff revision 2)
     
     

    Module docstring?

  3. reviewboard/site/mixins.py (Diff revision 2)
     
     

    Module docstring?

  4. 
      
chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (8a7c332)
Loading...