datasette / datasette-enrichments

Tools for running enrichments against data stored in Datasette
https://enrichments.datasette.io
Apache License 2.0
19 stars 0 forks source link

Ability to set permissions on a per-table and per-enrichment basis #24

Open simonw opened 10 months ago

simonw commented 10 months ago

I shipped a enrichments permission that can be coupled to a database.

There are actually two cases to consider here:

We may have enrichments (e.g. ones with expensive API keys) that are restricted to some users, independent of which tables they are allowed to run them against.

Maybe enrichment is the permission for selecting which enrichments they can use and enrich-table is the one for specific tables?

Originally posted by @simonw in https://github.com/datasette/datasette-enrichments/issues/12#issuecomment-1815745835

simonw commented 10 months ago

Here's the code that checks permissions:

https://github.com/datasette/datasette-enrichments/blob/eeded4173fff0614e2efe559022a9023e5ff8640/datasette_enrichments/views.py#L13-L17

And:

https://github.com/datasette/datasette-enrichments/blob/eeded4173fff0614e2efe559022a9023e5ff8640/datasette_enrichments/__init__.py#L305-L326