prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  rules/participate in project
  As you can see in the test, the paricipate_project rule behaves a bit weird for project group members. I think, they should also be allowed to participate. The question is what it is used for.
  
  Cool! The participate_project rule is a bit unexpected, so we should check that out. Like where it is used and what for. But anyway, will merge for now and add an issue.
  
  _Originally posted by @fuzzylogic2000 in https://github.com/liqd/a4-meinberlin/pull/4077#pullrequestreview-837466549_
  
  </issue>
  <code>
  [start of meinberlin/apps/projects/rules.py]
  1 import rules
  2 from rules.predicates import is_superuser
  3 
  4 from adhocracy4.organisations.predicates import is_initiator
  5 from adhocracy4.projects.predicates import is_live
  6 from adhocracy4.projects.predicates import is_moderator
  7 from adhocracy4.projects.predicates import is_prj_group_member
  8 from adhocracy4.projects.predicates import is_project_member
  9 from adhocracy4.projects.predicates import is_public
  10 from adhocracy4.projects.predicates import is_semipublic
  11 
  12 rules.remove_perm('a4projects.view_project')
  13 rules.add_perm('a4projects.view_project',
  14                is_superuser | is_initiator |
  15                is_moderator | is_prj_group_member |
  16                ((is_public | is_semipublic | is_project_member)
  17                 & is_live))
  18 
  19 rules.set_perm('a4projects.participate_in_project',
  20                is_superuser | is_initiator | is_moderator |
  21                ((is_public | is_project_member) & is_live))
  22
  [end of meinberlin/apps/projects/rules.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/meinberlin/apps/projects/rules.py b/meinberlin/apps/projects/rules.py
  --- a/meinberlin/apps/projects/rules.py
  +++ b/meinberlin/apps/projects/rules.py
  @@ -17,5 +17,6 @@
                   & is_live))
   
   rules.set_perm('a4projects.participate_in_project',
  -               is_superuser | is_initiator | is_moderator |
  +               is_superuser | is_initiator |
  +               is_moderator | is_prj_group_member |
                  ((is_public | is_project_member) & is_live))
  
verification_info: {"golden_diff": "diff --git a/meinberlin/apps/projects/rules.py b/meinberlin/apps/projects/rules.py\n--- a/meinberlin/apps/projects/rules.py\n+++ b/meinberlin/apps/projects/rules.py\n@@ -17,5 +17,6 @@\n                 & is_live))\n \n rules.set_perm('a4projects.participate_in_project',\n-               is_superuser | is_initiator | is_moderator |\n+               is_superuser | is_initiator |\n+               is_moderator | is_prj_group_member |\n                ((is_public | is_project_member) & is_live))\n", "issue": "rules/participate in project\nAs you can see in the test, the paricipate_project rule behaves a bit weird for project group members. I think, they should also be allowed to participate. The question is what it is used for.\r\n\r\nCool! The participate_project rule is a bit unexpected, so we should check that out. Like where it is used and what for. But anyway, will merge for now and add an issue.\r\n\r\n_Originally posted by @fuzzylogic2000 in https://github.com/liqd/a4-meinberlin/pull/4077#pullrequestreview-837466549_\n", "before_files": [{"content": "import rules\nfrom rules.predicates import is_superuser\n\nfrom adhocracy4.organisations.predicates import is_initiator\nfrom adhocracy4.projects.predicates import is_live\nfrom adhocracy4.projects.predicates import is_moderator\nfrom adhocracy4.projects.predicates import is_prj_group_member\nfrom adhocracy4.projects.predicates import is_project_member\nfrom adhocracy4.projects.predicates import is_public\nfrom adhocracy4.projects.predicates import is_semipublic\n\nrules.remove_perm('a4projects.view_project')\nrules.add_perm('a4projects.view_project',\n               is_superuser | is_initiator |\n               is_moderator | is_prj_group_member |\n               ((is_public | is_semipublic | is_project_member)\n                & is_live))\n\nrules.set_perm('a4projects.participate_in_project',\n               is_superuser | is_initiator | is_moderator |\n               ((is_public | is_project_member) & is_live))\n", "path": "meinberlin/apps/projects/rules.py"}]}