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

Make check_visibility() a documented API #1678

Closed
simonw opened this issue Mar 21, 2022 · 1 comment
Closed

Make check_visibility() a documented API #1678

simonw opened this issue Mar 21, 2022 · 1 comment

Comments

@simonw
Copy link
Owner

simonw commented Mar 21, 2022

Spotted this while working on:

async def check_visibility(datasette, actor, action, resource, default=True):
"""Returns (visible, private) - visible = can you see it, private = can others see it too"""
visible = await datasette.permission_allowed(
actor,
action,
resource=resource,
default=default,
)
if not visible:
return False, False
private = not await datasette.permission_allowed(
None,
action,
resource=resource,
default=default,
)
return visible, private

@simonw
Copy link
Owner Author

simonw commented Mar 21, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant