Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic groups feature #2

Closed
Tracked by #1
simonw opened this issue Aug 30, 2024 · 0 comments
Closed
Tracked by #1

Dynamic groups feature #2

simonw opened this issue Aug 30, 2024 · 0 comments

Comments

@simonw
Copy link
Contributor

simonw commented Aug 30, 2024

If there's no special mechanism for matching JSON on actors we could instead have code that dynamically adds or removes the actor from a group based on their JSON, matched against something in config? Then you could configure the plugin like this:

plugins:
  datasette-acl:
    dynamic-groups:
      admin:
        is_admin: true

Now any time we're about to run a permission check on an actor we first confirm that they are a member or NOT a member of the admin group based on matching them against that rule.

We can use actor_matches_allow(actor, allow) for that: https://github.com/simonw/datasette/blob/dc288056b81a3635bdb02a6d0121887db2720e5e/datasette/utils/__init__.py#L1025C5-L1026C1

Originally posted by @simonw in #1 (comment)

simonw added a commit that referenced this issue Aug 30, 2024
@simonw simonw closed this as completed in e520bff Aug 30, 2024
simonw added a commit that referenced this issue Aug 30, 2024
@simonw simonw added this to the Feature complete milestone Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant