sections: plugin_hooks:allow-alice-to-view-a-specific-table
This data as json
| id | page | ref | title | content | breadcrumbs | references |
|---|---|---|---|---|---|---|
| plugin_hooks:allow-alice-to-view-a-specific-table | plugin_hooks | allow-alice-to-view-a-specific-table | Allow Alice to view a specific table | This plugin grants the actor with id == "alice" permission to perform the view-table action against the sales table inside the accounting database. from datasette import hookimpl from datasette.permissions import PermissionSQL @hookimpl def permission_resources_sql(datasette, actor, action): if action != "view-table": return None if not actor or actor.get("id") != "alice": return None return PermissionSQL( sql=""" SELECT 'accounting' AS parent, 'sales' AS child, 1 AS allow, 'alice can view accounting/sales' AS reason """, ) | ["Plugin hooks", "permission_resources_sql(datasette, actor, action)", "Permission plugin examples"] | [] |