Advanced permission management for Datasette
Project description
datasette-acl
Advanced permission management for Datasette. Highly experimental.
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-acl
Usage
This plugin is under active development. For the moment, it only supports defining permissions for tables against dynamic groups, described below.
Permissions are saved in the internal database. This means you should run Datasette with the --internal path/to/internal.db
option, otherwise your permissions will be reset every time you restart Datasette.
Users with the new datasette-acl
permission will have the ability to access a UI for setting permissions for groups on a table.
To configure the root user to have this permission, add the following to your Datasette configuration:
permissions:
datasette-acl:
id: root
Alternatively you can start Datasette running like this:
datasette mydata.db --root --internal internal.db \
-s permissions.datasette-acl.id root
Dynamic groups
You may wish to define permission rules against groups of actors based on their actor attributes, without needing to manually add those actors to a group. This can be achieved by defining a dynamic group in the datasette-acl
configuration.
Dynamic groups are defined in terms of allow blocks. The following configuration defines two dynamic groups - one called admin
that contains all users with "is_admin": true
in their attributes, and another called sales
that explicitly lists the users with "sales"
as one of the values in their department
array.
plugins:
datasette-acl:
dynamic-groups:
admin:
is_admin": true
sales:
department: ["sales"]
Any time an actor has their permissions checked they will be dynamically added to or removed from these groups based on the current value of their actor attributes.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-acl
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
python -m pytest
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
File details
Details for the file datasette_acl-0.1a0.tar.gz
.
File metadata
- Download URL: datasette_acl-0.1a0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b123de76f2c0a3be3a3f5c2b9ac946611f3d8ae0d9f9b97fddc56ce427022825 |
|
MD5 | 8618d9b2abc3cfb90d21f40198e0d3bf |
|
BLAKE2b-256 | d2393f7238d2d09d9ba764c0af4b29fdade9cddadd4a27d372c135350330e8c6 |
File details
Details for the file datasette_acl-0.1a0-py3-none-any.whl
.
File metadata
- Download URL: datasette_acl-0.1a0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51e026d3c8baba68c8170194e7fd64e6179167fadedc29cb7ad5f4a34832039d |
|
MD5 | 5c70354ea91099333e857bbcc04374dd |
|
BLAKE2b-256 | 6a8f993103a8d938cb539f46ec8cb46a115bab2114e67d643d4d42225c631f96 |