simonw / django-sql-dashboard

Django app for building dashboards using raw SQL queries
https://django-sql-dashboard.datasette.io/
Apache License 2.0
437 stars 37 forks source link

Control access using a Django permission #1

Closed simonw closed 3 years ago

simonw commented 3 years ago

I was going to change this to superuser-only, but having it use a permission would both enable superuser access and allow other users to be granted access too.

https://docs.djangoproject.com/en/3.1/topics/auth/default/

I'm going to call the first new permission django_sql_dashboard.execute_sql.

simonw commented 3 years ago

Django expects permissions to be attached to model classes. It's possible to workaround this but the workarounds are a bit nasty: https://stackoverflow.com/questions/13932774/how-can-i-use-django-permissions-without-defining-a-content-type-or-model

I'm going to accelerate work on the Dashboard model that will allow dashboard configurations to be saved to the database.