{"html_url": "https://github.com/simonw/datasette/issues/1636#issuecomment-1334666806", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1636", "id": 1334666806, "node_id": "IC_kwDOBm6k_c5PjWY2", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T01:58:40Z", "updated_at": "2022-12-02T02:00:53Z", "author_association": "OWNER", "body": "Current design:\r\n\r\n```json\r\n{\r\n \"databases\": {\r\n \"private\": {\r\n \"allow\": {\r\n \"id\": \"*\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\nThis can be applied at the instance, database, table or query level within the nested JSON.\r\n\r\nhttps://docs.datasette.io/en/stable/authentication.html#controlling-access-to-specific-databases\r\n\r\nIt's actually controlling the following permissions:\r\n\r\n- `view-instance`\r\n- `view-database`\r\n- `view-table`\r\n- `view-query`\r\n\r\nThere's also a special case for allowing SQL queries,at the instance and database level:\r\n\r\n```json\r\n{\r\n \"databases\": {\r\n \"mydatabase\": {\r\n \"allow_sql\": {\r\n \"id\": \"root\"\r\n }\r\n }\r\n }\r\n}\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1138008042, "label": "\"permissions\" propery in metadata for configuring arbitrary permissions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1636#issuecomment-1334673179", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1636", "id": 1334673179, "node_id": "IC_kwDOBm6k_c5PjX8b", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T02:07:20Z", "updated_at": "2022-12-02T04:27:07Z", "author_association": "OWNER", "body": "So the new mechanism needs to extend that to handle all of the other permissions as well.\r\n\r\nThe simplest design I can think of is this (here illustrated using YAML):\r\n\r\n```yaml\r\n# instance-level permissions - give every logged in user the debug menu:\r\npermissions:\r\n debug-menu:\r\n id: *\r\ndatabases:\r\n content:\r\n # Allow bob to create-table in the content database\r\n permissions:\r\n create-table:\r\n id: bob\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1138008042, "label": "\"permissions\" propery in metadata for configuring arbitrary permissions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1636#issuecomment-1334757597", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1636", "id": 1334757597, "node_id": "IC_kwDOBm6k_c5Pjsjd", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T04:42:35Z", "updated_at": "2022-12-02T04:42:35Z", "author_association": "OWNER", "body": "Should I call this key `permissions` or something else?\r\n\r\nSome options:\r\n\r\n- `permissions`\r\n- `perms` - shorter to type\r\n- `allow` - I like the word, but might be confusing to change its meaning since we use it already", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1138008042, "label": "\"permissions\" propery in metadata for configuring arbitrary permissions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1636#issuecomment-1334758766", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1636", "id": 1334758766, "node_id": "IC_kwDOBm6k_c5Pjs1u", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T04:45:16Z", "updated_at": "2022-12-02T04:45:16Z", "author_association": "OWNER", "body": "Also, this is another thing which should live in `config.yml` rather than being crammed into `metadata.yml` - but I can fix that when I address:\r\n- #493", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1138008042, "label": "\"permissions\" propery in metadata for configuring arbitrary permissions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1636#issuecomment-1334759315", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1636", "id": 1334759315, "node_id": "IC_kwDOBm6k_c5Pjs-T", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T04:46:32Z", "updated_at": "2022-12-02T04:46:32Z", "author_association": "OWNER", "body": "Thankfully all of the logic for this already lives in just one place:\r\n\r\nhttps://github.com/simonw/datasette/blob/d7e5e3c9f98d194fdfb12f1ecc60ed5b3afbc464/datasette/default_permissions.py#L23-L59", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1138008042, "label": "\"permissions\" propery in metadata for configuring arbitrary permissions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335870877", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335870877, "node_id": "IC_kwDOBm6k_c5Pn8Wd", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T21:17:50Z", "updated_at": "2022-12-02T21:17:50Z", "author_association": "OWNER", "body": "https://simon.datasette.cloud/data/hacker_news_posts_atom.atom is working now.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335870879", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335870879, "node_id": "IC_kwDOBm6k_c5Pn8Wf", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T21:18:25Z", "updated_at": "2022-12-02T21:18:25Z", "author_association": "OWNER", "body": "This is the SQL view for the atom feed:\r\n```sql\r\nCREATE VIEW hacker_news_posts_atom as select\r\n id as atom_id,\r\n title as atom_title,\r\n url,\r\n commentsUrl as atom_link,\r\n dt || 'Z' as atom_updated,\r\n 'Submitter: ' || submitter || ' - ' || points || ' points, ' || numComments || ' comments' as atom_content\r\nfrom\r\n hacker_news_posts\r\norder by\r\n dt desc\r\nlimit\r\n 100;\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335870883", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335870883, "node_id": "IC_kwDOBm6k_c5Pn8Wj", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T21:19:10Z", "updated_at": "2022-12-02T21:19:10Z", "author_association": "OWNER", "body": "I created the `hacker_news_posts` table like this:\r\n\r\n```bash\r\nexport ROWS=$(\r\n jq -n --argjson rows \"$(cat simonwillison-net.json)\" \\\r\n '{ \"table\": \"hacker_news_posts\", \"rows\": $rows, \"pk\": \"id\", \"replace\": true }'\r\n)\r\n# Use curl to POST some JSON to a URL\r\ncurl -X POST \\\r\n https://simon.datasette.cloud/data/-/create \\\r\n -H \"Content-Type: application/json\" \\\r\n -H \"Authorization: Bearer $DS_TOKEN\" \\\r\n -d $ROWS\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335870884", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335870884, "node_id": "IC_kwDOBm6k_c5Pn8Wk", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T21:19:58Z", "updated_at": "2022-12-02T21:19:58Z", "author_association": "OWNER", "body": "But until I fix this issue:\r\n- https://github.com/simonw/datasette/issues/1927\r\n\r\nI need to insert freshly scraped data like this:\r\n\r\n```bash\r\nexport ROWS=$(\r\n jq -n --argjson rows \"$(cat simonwillison-net.json)\" \\\r\n '{ \"rows\": $rows, \"replace\": true }'\r\n)\r\n\r\ncurl -X POST \\\r\n https://simon.datasette.cloud/data/hacker_news_posts/-/insert \\\r\n -H \"Content-Type: application/json\" \\\r\n -H \"Authorization: Bearer $DS_TOKEN\" \\\r\n -d $ROWS\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335870887", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335870887, "node_id": "IC_kwDOBm6k_c5Pn8Wn", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T21:25:16Z", "updated_at": "2022-12-02T21:25:16Z", "author_association": "OWNER", "body": "Here's the change that should submit data to Datasette Cloud: https://github.com/simonw/scrape-hacker-news-by-domain/commit/848bb7e835a9fb87cd656362591835179cd1dc1b\r\n\r\nI ran `delete from hacker_news_posts` against my instance so https://simon.datasette.cloud/data/hacker_news_posts is now empty.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335870889", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335870889, "node_id": "IC_kwDOBm6k_c5Pn8Wp", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T21:41:09Z", "updated_at": "2022-12-02T21:41:09Z", "author_association": "OWNER", "body": "Got it working!\r\n\r\nhttps://simon.datasette.cloud/data/hacker_news_posts\r\n\r\nhttps://github.com/simonw/scrape-hacker-news-by-domain/blob/main/submit-to-datasette-cloud.sh", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1928#issuecomment-1335966329", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1928", "id": 1335966329, "node_id": "IC_kwDOBm6k_c5PoTp5", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-02T23:47:11Z", "updated_at": "2022-12-02T23:47:11Z", "author_association": "OWNER", "body": "Wrote about this extensively here: https://simonwillison.net/2022/Dec/2/datasette-write-api/", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1473481262, "label": "Hacker News Datasette write demo"}, "performed_via_github_app": null}