prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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.
  
  </issue>
  <code>
  [start of mathesar/api/ui/permissions/shares.py]
  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 of mathesar/api/ui/permissions/shares.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
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"}]}