This token will allow API access with the same abilities as your current user.
\r\n+\r\ndiff --git a/datasette/views/special.py b/datasette/views/special.py\r\nindex 30345d14..48357f87 100644\r\n--- a/datasette/views/special.py\r\n+++ b/datasette/views/special.py\r\n@@ -231,12 +231,37 @@ class CreateTokenView(BaseView):\r\n return await self.render(\r\n [\"create_token.html\"],\r\n request,\r\n- {\"actor\": request.actor},\r\n+ {\r\n+ \"actor\": request.actor,\r\n+ \"all_permissions\": self.ds.permissions.keys(),\r\n+ \"database_permissions\": [\r\n+ key\r\n+ for key, value in self.ds.permissions.items()\r\n+ if value.takes_database\r\n+ ],\r\n+ \"table_permissions\": [\r\n+ key\r\n+ for key, value in self.ds.permissions.items()\r\n+ if value.takes_resource\r\n+ ],\r\n+ \"databases\": [k for k in self.ds.databases.keys() if k != \"_internal\"],\r\n+ \"database_with_tables\": [\r\n+ {\r\n+ \"database\": db.name,\r\n+ \"tables\": await db.table_names(),\r\n+ }\r\n+ for db in self.ds.databases.values()\r\n+ if db.name != \"_internal\"\r\n+ ],\r\n+ },\r\n )\r\n \r\n async def post(self, request):\r\n self.check_permission(request)\r\n post = await request.post_vars()\r\n+ from pprint import pprint\r\n+\r\n+ pprint(post)\r\n errors = []\r\n duration = None\r\n if post.get(\"expire_type\"):\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1855#issuecomment-1347695728", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1855", "id": 1347695728, "node_id": "IC_kwDOBm6k_c5QVDRw", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-13T03:30:09Z", "updated_at": "2022-12-13T03:30:09Z", "author_association": "OWNER", "body": "I just noticed this in the existing code:\r\n\r\nhttps://github.com/simonw/datasette/blob/c5d30b58a1cd1c66bbddcf3561db005543ecaf25/datasette/default_permissions.py#L195-L203\r\n\r\nHard-coding those action names should not be necessary any more, especially now we have `datasette.permissions` for looking up metadata about the permissions.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423336089, "label": "`datasette create-token` ability to create tokens with a reduced set of permissions"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/pull/1938#issuecomment-1347767048", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1938", "id": 1347767048, "node_id": "IC_kwDOBm6k_c5QVUsI", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-13T05:23:18Z", "updated_at": "2022-12-13T05:23:18Z", "author_association": "OWNER", "body": "I landed this already:\r\n- #1636 ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1485488236, "label": "\"permissions\" blocks in metadata.json/yaml"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1958#issuecomment-1352644262", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1958", "id": 1352644262, "node_id": "IC_kwDOBm6k_c5Qn7am", "user": {"value": 11729897, "label": "davidhaley"}, "created_at": "2022-12-13T16:49:31Z", "updated_at": "2022-12-13T16:49:52Z", "author_association": "NONE", "body": "I may have found the reason. I don't think the `--root` option is taking effect.\r\n\r\nVisited: http://127.0.0.1:8001/-/permissions\r\n\r\n![image](https://user-images.githubusercontent.com/11729897/207394127-59f8320f-3410-4ff8-869d-b19ab955d67c.png)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497909798, "label": "datasette --root running in Docker doesn't reliably show the magic URL"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1948#issuecomment-1347766530", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1948", "id": 1347766530, "node_id": "IC_kwDOBm6k_c5QVUkC", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-13T05:22:19Z", "updated_at": "2022-12-13T05:22:19Z", "author_association": "OWNER", "body": "I tested:\r\n\r\n```\r\n{\"id\": \"root\", \"_r\": {\"a\": \"view-table\"}}\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493404423, "label": "500 error on permission debug page when testing actors with _r"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350002434", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350002434, "node_id": "IC_kwDOBm6k_c5Qd2cC", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-13T23:11:50Z", "updated_at": "2022-12-13T23:11:59Z", "author_association": "OWNER", "body": "I think checkboxes will work well.\r\n\r\nHere's the data I get back from them (as `post_vars()`):\r\n\r\n```\r\n{'all:debug-menu': 'on',\r\n 'all:insert-row': 'on',\r\n 'expire_duration': '',\r\n 'expire_type': '',\r\n 'table:fixtures:delete-row': 'on',\r\n 'table:fixtures:drop-table': 'on',\r\n 'table:fixtures:view-query': 'on'}\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1855#issuecomment-1347675456", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1855", "id": 1347675456, "node_id": "IC_kwDOBm6k_c5QU-VA", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-13T02:57:46Z", "updated_at": "2022-12-13T02:57:46Z", "author_association": "OWNER", "body": "I was going to have the CLI command throw an error if you attempt to use a permission that isn't registered with Datasette, but then I remembered that one of the uses for the CLI tool is to create signed tokens that will work against other Datasette instances (via the `--secret` option) that might have different plugins installed that register different permission names.\r\n\r\nSo I might have it output warnings instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423336089, "label": "`datasette create-token` ability to create tokens with a reduced set of permissions"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1349972480", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1349972480, "node_id": "IC_kwDOBm6k_c5QdvIA", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-13T22:58:51Z", "updated_at": "2022-12-13T22:58:51Z", "author_association": "OWNER", "body": "I'm experimenting with a `
\r\n+\r\n+