mirror of
https://github.com/simonw/datasette.git
synced 2026-05-27 12:34:37 +02:00
Rename set-column-types action to et-column-type
Refs https://github.com/simonw/datasette/pull/2674#issuecomment-4085015792
This commit is contained in:
parent
d440c20984
commit
2b06da29a1
7 changed files with 18 additions and 20 deletions
|
|
@ -86,9 +86,9 @@ def register_actions():
|
|||
resource_class=TableResource,
|
||||
),
|
||||
Action(
|
||||
name="set-column-types",
|
||||
name="set-column-type",
|
||||
abbr="sct",
|
||||
description="Set column types",
|
||||
description="Set column type",
|
||||
resource_class=TableResource,
|
||||
),
|
||||
Action(
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ class TableSetColumnTypeView(BaseView):
|
|||
table_name = resolved.table
|
||||
|
||||
if not await self.ds.allowed(
|
||||
action="set-column-types",
|
||||
action="set-column-type",
|
||||
resource=TableResource(database=database_name, table=table_name),
|
||||
actor=request.actor,
|
||||
):
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ The one exception is the "root" account, which you can sign into while using Dat
|
|||
The ``--root`` flag is designed for local development and testing. When you start Datasette with ``--root``, the root user automatically receives every permission, including:
|
||||
|
||||
* All view permissions (``view-instance``, ``view-database``, ``view-table``, etc.)
|
||||
* All write permissions (``insert-row``, ``update-row``, ``delete-row``, ``create-table``, ``alter-table``, ``set-column-types``, ``drop-table``)
|
||||
* All write permissions (``insert-row``, ``update-row``, ``delete-row``, ``create-table``, ``alter-table``, ``set-column-type``, ``drop-table``)
|
||||
* Debug permissions (``permissions-debug``, ``debug-menu``)
|
||||
* Any custom permissions defined by plugins
|
||||
|
||||
|
|
@ -886,7 +886,7 @@ To grant ``create-table`` to the user with ``id`` of ``editor`` for the ``docs``
|
|||
}
|
||||
.. [[[end]]]
|
||||
|
||||
Other table-scoped write permissions, including ``set-column-types``, can be configured in the same place.
|
||||
Other table-scoped write permissions, including ``set-column-type``, can be configured in the same place.
|
||||
|
||||
And for ``insert-row`` against the ``reports`` table in that ``docs`` database:
|
||||
|
||||
|
|
@ -1212,9 +1212,7 @@ To include an expiry pass ``expire_after=`` to ``datasette.set_actor_cookie()``
|
|||
.. code-block:: python
|
||||
|
||||
response = Response.redirect("/")
|
||||
datasette.set_actor_cookie(
|
||||
response, {"id": "cleopaws"}, expire_after=60 * 60 * 24
|
||||
)
|
||||
datasette.set_actor_cookie(response, {"id": "cleopaws"}, expire_after=60 * 60 * 24)
|
||||
|
||||
The resulting cookie will encode data that looks something like this:
|
||||
|
||||
|
|
@ -1350,10 +1348,10 @@ Actor is allowed to alter a database table.
|
|||
|
||||
``table`` is the name of the table (string)
|
||||
|
||||
.. _actions_set_column_types:
|
||||
.. _actions_set_column_type:
|
||||
|
||||
set-column-types
|
||||
----------------
|
||||
set-column-type
|
||||
---------------
|
||||
|
||||
Actor is allowed to set assigned column types for columns in a table.
|
||||
|
||||
|
|
|
|||
|
|
@ -946,7 +946,7 @@ Pass ``"alter": true`` to automatically add any missing columns to the existing
|
|||
Setting a column type
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To set a column type for a table column, make a ``POST`` to ``/<database>/<table>/-/set-column-type``. This requires the :ref:`actions_set_column_types` permission.
|
||||
To set a column type for a table column, make a ``POST`` to ``/<database>/<table>/-/set-column-type``. This requires the :ref:`actions_set_column_type` permission.
|
||||
|
||||
::
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ def test_auth_create_token(
|
|||
"all:view-query",
|
||||
"database:fixtures:drop-table",
|
||||
"resource:fixtures:foreign_key_references:insert-row",
|
||||
"resource:fixtures:facetable:set-column-types",
|
||||
"resource:fixtures:facetable:set-column-type",
|
||||
}
|
||||
)
|
||||
# Now try actually creating one
|
||||
|
|
@ -430,7 +430,7 @@ async def test_root_with_root_enabled_gets_all_permissions(ds_client):
|
|||
|
||||
assert (
|
||||
await ds_client.ds.allowed(
|
||||
action="set-column-types",
|
||||
action="set-column-type",
|
||||
resource=TableResource("fixtures", "facetable"),
|
||||
actor=root_actor,
|
||||
)
|
||||
|
|
@ -504,9 +504,9 @@ async def test_root_without_root_enabled_no_special_permissions(ds_client):
|
|||
|
||||
assert (
|
||||
await ds_client.ds.allowed(
|
||||
action="set-column-types",
|
||||
action="set-column-type",
|
||||
resource=TableResource("fixtures", "facetable"),
|
||||
actor=root_actor,
|
||||
)
|
||||
is not True
|
||||
), "Root without root_enabled should not automatically get set-column-types"
|
||||
), "Root without root_enabled should not automatically get set-column-type"
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ async def test_get_action(ds_client):
|
|||
"vt",
|
||||
"view-table",
|
||||
"sct",
|
||||
"set-column-types",
|
||||
"set-column-type",
|
||||
):
|
||||
action = ds.get_action(name_or_abbr)
|
||||
if "-" in name_or_abbr:
|
||||
|
|
|
|||
|
|
@ -831,19 +831,19 @@ PermConfigTestCase = collections.namedtuple(
|
|||
resource=("perms_ds_one", "t1"),
|
||||
expected_result=True,
|
||||
),
|
||||
# set-column-types on specific table
|
||||
# set-column-type on specific table
|
||||
PermConfigTestCase(
|
||||
config={
|
||||
"databases": {
|
||||
"perms_ds_one": {
|
||||
"tables": {
|
||||
"t1": {"permissions": {"set-column-types": {"id": "user"}}}
|
||||
"t1": {"permissions": {"set-column-type": {"id": "user"}}}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
actor={"id": "user"},
|
||||
action="set-column-types",
|
||||
action="set-column-type",
|
||||
resource=("perms_ds_one", "t1"),
|
||||
expected_result=True,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue