home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 640362879

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/811#issuecomment-640362879 https://api.github.com/repos/simonw/datasette/issues/811 640362879 MDEyOklzc3VlQ29tbWVudDY0MDM2Mjg3OQ== 9599 2020-06-08T04:42:28Z 2020-06-08T13:39:46Z OWNER

I'm finding myself repeating this pattern a lot: python for table in table_counts: allowed = await self.ds.permission_allowed( request.scope.get("actor"), "view-table", resource_type="table", resource_identifier=(database, table), default=True, ) if not allowed: continue private = not await self.ds.permission_allowed( None, "view-table", resource_type="table", resource_identifier=(database, table), ) I use a similar pattern for lists of databases and lists of queries, and I'll be doing the same thing for lists of SQL views too.

An abstraction around this would be useful.

Idea:

python visible, private = await check_visibility( self.ds, actor, "view-table", "table", (database, table) )

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
633578769  
Powered by Datasette · Queries took 1.032ms · About: github-to-sqlite