playfire / django-debug-toolbar-user-panel

Panel for the Django Debug toolbar to quickly switch between users
http://code.playfire.com/django-debug-toolbar-user-panel/
BSD 3-Clause "New" or "Revised" License
81 stars 31 forks source link

New Feature: Force initial login as superuser (resubmission) #6

Closed pipermerriam closed 12 years ago

pipermerriam commented 12 years ago

The user panel now looks for DEBUG_TOOLBAR_USER_PANEL_SECURE in the settings module. If set to True, the user panel will only function if logged in initially as a superuser. If the setting is not present, the toolbar defaults to being enabled.

Added process_request method to panel which sets an 'enabled' flag on the session based on whether the toolbar should be enabled or not.

Added conditional to content template to hide all forms and show a help message if the panel is disabled.

Added logic to views to check if the toolbar should be disabled. In primary view, an enabled flag has been added to the template context. In the login and login_form views, the django PermissionDenied exception is raised.

pipermerriam commented 12 years ago

Sorry, just found a bug I missed in testing. Closing.