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

View and edit permissions for dashboards #27

Closed simonw closed 3 years ago

simonw commented 3 years ago

The ability to control who can view a dashboard, and who can edit a dashboard at the individual dashboard level.

simonw commented 3 years ago

I'm going to optionally use Django auth groups for this, if they are defined.

I think a select box for "who can view" and a select box for "who can edit" will work. Following options:

simonw commented 3 years ago

I'm going to add six columns to Dashboard for this:

simonw commented 3 years ago

The policy enums will cover:

simonw commented 3 years ago

Another view permission option: unlisted - available to the public but only if they know the dashboard URL.

These ones won't be shown on the /dashboard/ index page and will have robots SEO exclusion.

simonw commented 3 years ago

Model changes in the admin (I customized the admin fieldsets):

Mozilla_Firefox
simonw commented 3 years ago

https://github.com/simonw/django-sql-dashboard/blob/cfe3c18f27d4d0f463c163406b7fe9370f7b560a/django_sql_dashboard/models.py#L6-L59

simonw commented 3 years ago

I'm going to change created_by to owned_by since that makes it clear that it's OK for a user to "transfer ownership" of a dashboard to someone else.

simonw commented 3 years ago

Next steps: get the dashboards to obey these permissions, with comprehensive tests. Editing can still happen through the admin interface for the moment.

Dashboards should include a visible note that explains who is allowed to edit or view the dashboard.

simonw commented 3 years ago

The remaining edit work will take place in #44.