A panel for Django Debug Toolbar (DjDT) to display the current user's permissions.
Project description
Permission panel for Django Debug Toolbar
A simple DjDT panel displaying the permissions granted to the current user, how the current user obtained each one of them (directly or through a group membership), and the resulting consolidated permissions set.
Installation (on top of Django Debug Toolbar)
First, install django-debug-toolbar
(instructions
here), then:
-
Install permission panel, either with Pip or Poetry:
pip install 'git+https://github.com/baudhuina/djdt-permissions.git@1.0.0#egg=djdt_permissions'
or complete your project's
pyproject.toml
file with XXX TO BE COMPLETED and runpoetry install
orpoetry update
. -
Add
djdt_permission
toINSTALLED_APPS
, make sure it's belowdjango.toolbar
:Please note that just as the Debug Toolbar, this panel is not supposed to be installed if 'DEBUG' is False.
if DEBUG == True: INSTALLED_APPS += [ ... 'debug_toolbar', 'djdt_permissions', ... ]
-
Register the new panel by adding path
djdt_permissions.panels.PermissionsPanel
to settingDEBUG_TOOLBAR_PANELS
(which is entirely conditional toDEBUG
). The sequence of the panels defines their order in the toolbar.DEBUG_TOOLBAR_PANELS = [ 'djdt_permissions.panels.PermissionsPanel', 'debug_toolbar.panels.history.HistoryPanel', 'debug_toolbar.panels.versions.VersionsPanel', # ... any other panel. ]
-
(optional) If you want the panel to be disabled by default, add its full path in the
DEBUG_TOOLBAR_CONFIG[DISABLE_PANELS]
set.DEBUG_TOOLBAR_CONFIG = { "DISABLE_PANELS": { 'djdt_permissions.panels.permissions_panelPermissionsPanel', # any other panel to disable }, # other config settings. ]
Usage
The Permission Panel is used just as any other panel of the Django Debug Toolbar:
- Open DJdT overlay;
- Enable, disable, consult the panel at will...
Installing the test project
Would you wish to modify/contribute to this project:
- Fork the GIT repo from GitHub. It contains a Django test project.
- Install dependencies:
poetry install
. - Apply migrations:
manage.py migrate [--settings=test_project.settings]
. - Run server:
manage.py runserver [--settings=test_project.settings]
. - Point your browser at http://localhost:8000.
Running the tests
Once the test project is installed (see above), run the tests with:
```
manage.py test [--database=<your_database>] [--settings=<your_settings>]
```
Contact me
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for djdt_permissions-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 484ad2a6ad9f85ffd79a2def1c0119fa0855a3761fce58e2b943c18867646c32 |
|
MD5 | d51f57bd48e4820966c549b056a8728a |
|
BLAKE2b-256 | ff1a961325d112ef405ae83dd64f270e8366dc111586403a77e9ee76853ac90e |