prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Implement frontend flow: User sharing an entity
  I've not added a description, since I'll be implementing this.
  
  Refer [Product spec](https://wiki.mathesar.org/en/product/specs/publicly-shareable-links) for detailed info.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mathesar/api/ui/permissions/shares.py`
  Content:
  ```
  1 from rest_access_policy import AccessPolicy
  2 
  3 from mathesar.api.utils import get_query_or_404
  4 from mathesar.api.permission_utils import QueryAccessInspector
  5 
  6 
  7 class SharedTableAccessPolicy(AccessPolicy):
  8     statements = [
  9         {
  10             'action': ['list', 'retrieve'],
  11             'principal': 'authenticated',
  12             'effect': 'allow',
  13             'condition_expression': 'is_atleast_viewer_nested_table_resource'
  14         },
  15         {
  16             'action': ['create', 'destroy', 'update', 'partial_update'],
  17             'principal': 'authenticated',
  18             'effect': 'allow',
  19             'condition_expression': 'is_atleast_manager_nested_table_resource'
  20         },
  21     ]
  22 
  23 
  24 class SharedQueryAccessPolicy(AccessPolicy):
  25     statements = [
  26         {
  27             'action': ['list', 'retrieve'],
  28             'principal': 'authenticated',
  29             'effect': 'allow',
  30             'condition_expression': 'is_atleast_query_viewer'
  31         },
  32         {
  33             'action': ['create', 'destroy', 'update', 'partial_update'],
  34             'principal': 'authenticated',
  35             'effect': 'allow',
  36             'condition_expression': 'is_atleast_query_editor'
  37         },
  38     ]
  39 
  40     def is_atleast_query_viewer(self, request, view, action):
  41         query = get_query_or_404(view.kwargs['query_pk'])
  42         return QueryAccessInspector(request.user, query).is_atleast_viewer()
  43 
  44     def is_atleast_query_editor(self, request, view, action):
  45         query = get_query_or_404(view.kwargs['query_pk'])
  46         return QueryAccessInspector(request.user, query).is_atleast_editor()
  47
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mathesar/api/ui/permissions/shares.py b/mathesar/api/ui/permissions/shares.py
  --- a/mathesar/api/ui/permissions/shares.py
  +++ b/mathesar/api/ui/permissions/shares.py
  @@ -16,7 +16,7 @@
               'action': ['create', 'destroy', 'update', 'partial_update'],
               'principal': 'authenticated',
               'effect': 'allow',
  -            'condition_expression': 'is_atleast_manager_nested_table_resource'
  +            'condition_expression': 'is_atleast_editor_nested_table_resource'
           },
       ]
  
verification_info: {"golden_diff": "diff --git a/mathesar/api/ui/permissions/shares.py b/mathesar/api/ui/permissions/shares.py\n--- a/mathesar/api/ui/permissions/shares.py\n+++ b/mathesar/api/ui/permissions/shares.py\n@@ -16,7 +16,7 @@\n             'action': ['create', 'destroy', 'update', 'partial_update'],\n             'principal': 'authenticated',\n             'effect': 'allow',\n-            'condition_expression': 'is_atleast_manager_nested_table_resource'\n+            'condition_expression': 'is_atleast_editor_nested_table_resource'\n         },\n     ]\n", "issue": "Implement frontend flow: User sharing an entity\nI've not added a description, since I'll be implementing this.\r\n\r\nRefer [Product spec](https://wiki.mathesar.org/en/product/specs/publicly-shareable-links) for detailed info.\n", "before_files": [{"content": "from rest_access_policy import AccessPolicy\n\nfrom mathesar.api.utils import get_query_or_404\nfrom mathesar.api.permission_utils import QueryAccessInspector\n\n\nclass SharedTableAccessPolicy(AccessPolicy):\n    statements = [\n        {\n            'action': ['list', 'retrieve'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_viewer_nested_table_resource'\n        },\n        {\n            'action': ['create', 'destroy', 'update', 'partial_update'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_manager_nested_table_resource'\n        },\n    ]\n\n\nclass SharedQueryAccessPolicy(AccessPolicy):\n    statements = [\n        {\n            'action': ['list', 'retrieve'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_query_viewer'\n        },\n        {\n            'action': ['create', 'destroy', 'update', 'partial_update'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_query_editor'\n        },\n    ]\n\n    def is_atleast_query_viewer(self, request, view, action):\n        query = get_query_or_404(view.kwargs['query_pk'])\n        return QueryAccessInspector(request.user, query).is_atleast_viewer()\n\n    def is_atleast_query_editor(self, request, view, action):\n        query = get_query_or_404(view.kwargs['query_pk'])\n        return QueryAccessInspector(request.user, query).is_atleast_editor()\n", "path": "mathesar/api/ui/permissions/shares.py"}], "after_files": [{"content": "from rest_access_policy import AccessPolicy\n\nfrom mathesar.api.utils import get_query_or_404\nfrom mathesar.api.permission_utils import QueryAccessInspector\n\n\nclass SharedTableAccessPolicy(AccessPolicy):\n    statements = [\n        {\n            'action': ['list', 'retrieve'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_viewer_nested_table_resource'\n        },\n        {\n            'action': ['create', 'destroy', 'update', 'partial_update'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_editor_nested_table_resource'\n        },\n    ]\n\n\nclass SharedQueryAccessPolicy(AccessPolicy):\n    statements = [\n        {\n            'action': ['list', 'retrieve'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_query_viewer'\n        },\n        {\n            'action': ['create', 'destroy', 'update', 'partial_update'],\n            'principal': 'authenticated',\n            'effect': 'allow',\n            'condition_expression': 'is_atleast_query_editor'\n        },\n    ]\n\n    def is_atleast_query_viewer(self, request, view, action):\n        query = get_query_or_404(view.kwargs['query_pk'])\n        return QueryAccessInspector(request.user, query).is_atleast_viewer()\n\n    def is_atleast_query_editor(self, request, view, action):\n        query = get_query_or_404(view.kwargs['query_pk'])\n        return QueryAccessInspector(request.user, query).is_atleast_editor()\n", "path": "mathesar/api/ui/permissions/shares.py"}]}