mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
actors_from_ids plugin hook and datasette.actors_from_ids() method (#2181)
* Prototype of actors_from_ids plugin hook, refs #2180 * datasette-remote-actors example plugin, refs #2180
This commit is contained in:
parent
c26370485a
commit
b645174271
5 changed files with 155 additions and 0 deletions
|
|
@ -819,6 +819,16 @@ class Datasette:
|
|||
)
|
||||
return crumbs
|
||||
|
||||
async def actors_from_ids(
|
||||
self, actor_ids: Iterable[Union[str, int]]
|
||||
) -> Dict[Union[id, str], Dict]:
|
||||
result = pm.hook.actors_from_ids(datasette=self, actor_ids=actor_ids)
|
||||
if result is None:
|
||||
# Do the default thing
|
||||
return {actor_id: {"id": actor_id} for actor_id in actor_ids}
|
||||
result = await await_me_maybe(result)
|
||||
return result
|
||||
|
||||
async def permission_allowed(
|
||||
self, actor, action, resource=None, default=DEFAULT_NOT_SET
|
||||
):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue