Skip to content

Commit

Permalink
Improved --help for create-token, refs #1947
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Dec 13, 2022
1 parent f84acae commit d4cc137
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions datasette/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,13 +701,19 @@ def create_token(
datasette create-token root --secret mysecret
To only allow create-table:
To allow only "view-database-download" for all databases:
\b
datasette create-token root --secret mysecret \\
--all create-table
--all view-database-download
Or to only allow insert-row against a specific table:
To allow "create-table" against a specific database:
\b
datasette create-token root --secret mysecret \\
--database mydb create-table
To allow "insert-row" against a specific table:
\b
datasette create-token root --secret myscret \\
Expand Down
11 changes: 8 additions & 3 deletions docs/cli-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,17 @@ Create a signed API token, see :ref:`authentication_cli_create_token`.

datasette create-token root --secret mysecret

To only allow create-table:
To allow only "view-database-download" for all databases:

datasette create-token root --secret mysecret \
--all create-table
--all view-database-download

Or to only allow insert-row against a specific table:
To allow "create-table" against a specific database:

datasette create-token root --secret mysecret \
--database mydb create-table

To allow "insert-row" against a specific table:

datasette create-token root --secret myscret \
--resource mydb mytable insert-row
Expand Down

0 comments on commit d4cc137

Please sign in to comment.