code: def permission_allowed_default(datasette, actor, action, resource):
      async def inner():
          # id=root gets some special permissions:
          if action in (
              "permissions-debug",
              "debug-menu",
              "insert-row",
              "create-table",
              "drop-table",
              "delete-row",
              "update-row",
          ):
              if actor and actor.get("id") == "root":
                  return True
  
          # Resolve metadata view permissions
          if action in (
              "view-instance",
              "view-database",
              "view-table",
              "view-query",
              "execute-sql",
          ):
              result = await _resolve_config_view_permissions(
                  datasette, actor, action, resource
              )
              if result is not None:
                  return result
  
          # Check custom permissions: blocks
          result = await _resolve_config_permissions_blocks(
              datasette, actor, action, resource
          )
          if result is not None:
              return result
  
          # --setting default_allow_sql
          if action == "execute-sql" and not datasette.setting(
              "default_allow_sql"
          ):
              return False
  
      return inner
  
file_path: datasette/datasette/default_permissions.py
imports: from datasette import hookimpl, Permission
  from datasette.utils import actor_matches_allow
  import itsdangerous
  import time
  from typing import Union, Tuple
label_desc: Use image node_id 2 for calling a global function with example usage: permission_allowed_default(datasette, actor, action, resource) and returns: inner, result, False, True, result