[OAuth2Provider] Added API and resource in front end to manage OAuth2 client apps

Review Request #7993 - Created Feb. 23, 2016 and discarded

Minh Le Hoang
Review Board
master
7941
reviewboard
brennie, chipx86
This patch add full API support to get lists of OAuth2 client app,
get, update or delete a single app instance or create a new one.
User can also operate those operation through the webUI at My account
page.

Ran python ./tests/runtests.py reviewboard.webapi.tests.test_oauth2_client_app

Test DELETE, GET, PUT on single item
Test GET, POST on list endpoint

  • 0
  • 0
  • 56
  • 6
  • 62
Description From Last Updated
Review Bot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/user.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/accounts/forms/pages.py
        reviewboard/webapi/resources/oauth2_client_app.py
    
    Ignored Files:
        reviewboard/templates/accounts/oauth2_client_application.html
        reviewboard/static/rb/js/resources/models/oauth2ClientAppModel.js
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2ClientAppsView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/user.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/accounts/forms/pages.py
        reviewboard/webapi/resources/oauth2_client_app.py
    
    Ignored Files:
        reviewboard/templates/accounts/oauth2_client_application.html
        reviewboard/static/rb/js/resources/models/oauth2ClientAppModel.js
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2ClientAppsView.js
    
    
  2. Col: 80
     E501 line too long (84 > 79 characters)
    
  3.  'webapi_check_local_site' imported but unused
    
  4. Col: 80
     E501 line too long (92 > 79 characters)
    
  5. Col: 27
     E251 unexpected spaces around keyword / parameter equals
    
  6. Col: 80
     E501 line too long (81 > 79 characters)
    
  7. Col: 80
     E501 line too long (80 > 79 characters)
    
  8. 
      
Christian Hammond
  1. 
      
  2. reviewboard/accounts/forms/pages.py (Diff revision 1)
     
     
     

    These should probably be rolled up into the change introducing this code. Same with all other relevant code.

  3. Should be rolled up into the change that introduces this.

  4. No need for this. Instead, pass a this parameter to ready, and you'll be able to use this within the callback function.

    Like:

    this.model.resource.ready({
        ready: function() {
            ...
        }
    }, this);
    
  5. Please make sure you're following the proper styles and types for all these.

  6. You can't call gettext() on a variable. Only on literal strings. The saveButtonText and title values passed in must use gettext().

  7. Can't call gettext() on a variable.

  8. You can just bind to this._cancel.

  9. Should be more descriptive, like _onConfirmCancelClicked.

    Also, callback handlers should go after any other private functions.

  10. Multi-line comments must be in the form of:

    /*
     * line
     * line
     */
    

    Also, these are wrapping too early.

  11. Indentation is wrong on the secnod line. Must indent only 4 spaces.

    Same below.

  12. Should be _$clientIdField. No capital C.

  13. This is too long. Instead, wrap like:

    this._$authorizationGrantTypeField =
        this._$selectAUthorizationGrantType.bindProperty(
            ...);
    
  14. Should be something like _onSaveAppClicked.

  15. This should all be done directly in render.

  16. This should probably be rolled back into the change introducing this.

  17. reviewboard/webapi/resources/oauth2_client_app.py (Diff revision 1)
     
     
     
     
     
     
     

    Should all be in the same import group, in alphabetical order.

  18. These should not be in the same import group.

  19. Blank line between these.

  20. reviewboard/webapi/resources/oauth2_client_app.py (Diff revision 1)
     
     
     
     
     
     
     
     
     

    We probably want a has_list_access_permissions that prevents anyone but this user from accessing these apps.

  21. This should go into more detail about how to use this resource. This will be directly used in our online docs.

  22. No comma, since this is a function call.

  23. "client"

    This should also go into further details on the kind of updates that are allowed.

  24. reviewboard/webapi/resources/oauth2_client_app.py (Diff revision 1)
     
     
     
     
     
     
     

    Each keyword argument should actually be a keyword argument on the function, defaulting to None.

  25. Blank line between these.

  26. Each keyword argument should actually be a keyword argument on the function.

    1. Using kwargs seem much easier to maintain since we only need to pass **kwargs

  27. Blank line between these.

  28. Blank line between these.

  29. Blank line between these.

  30. 
      
Minh Le Hoang
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/oauth2_client_app.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/test_oauth2_client_app.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2ClientAppModel.js
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2ClientAppsView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/oauth2_client_app.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/test_oauth2_client_app.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2ClientAppModel.js
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2ClientAppsView.js
    
    
  2.  'timezone' imported but unused
    
  3. Col: 80
     E501 line too long (80 > 79 characters)
    
  4. Col: 80
     E501 line too long (80 > 79 characters)
    
  5. Col: 80
     E501 line too long (85 > 79 characters)
    
  6. Col: 80
     E501 line too long (86 > 79 characters)
    
  7. Col: 80
     E501 line too long (80 > 79 characters)
    
  8. Col: 80
     E501 line too long (83 > 79 characters)
    
  9. Col: 80
     E501 line too long (86 > 79 characters)
    
  10. Col: 5
     E303 too many blank lines (2)
    
  11. Col: 69
     W292 no newline at end of file
    
  12. 
      
Minh Le Hoang
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/oauth2_client_app.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/test_oauth2_client_app.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2ClientAppModel.js
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2ClientAppsView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/oauth2_client_app.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/test_oauth2_client_app.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2ClientAppModel.js
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2ClientAppsView.js
    
    
  2. Col: 80
     E501 line too long (80 > 79 characters)
    
  3. Col: 80
     E501 line too long (80 > 79 characters)
    
  4. Col: 80
     E501 line too long (80 > 79 characters)
    
  5. 
      
Barret Rennie
Review request changed

Status: Discarded

Loading...