We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Site-wide project creation permission
### Describe the problem

With https://github.com/WeblateOrg/weblate/issues/263 there needs to be a way to grant users creating a project. Currently, there are two approaches depending on the server settings – either via billing limits, or by site-wide permission.

### Describe the solution you'd like

Add role with the side-wide permission so that it can be easily assigned to the users.

### Describe alternatives you've considered

_No response_

### Screenshots

_No response_

### Additional context

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `weblate/auth/data.py`
Content:
```
1 # Copyright © Michal Čihař <michal@weblate.org>
2 #
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 
5 """Definition of permissions and default roles and groups."""
6 
7 from __future__ import annotations
8 
9 from django.utils.translation import gettext_noop
10 
11 from weblate.utils.translation import pgettext_noop
12 
13 SELECTION_MANUAL = 0
14 SELECTION_ALL = 1
15 SELECTION_COMPONENT_LIST = 2
16 SELECTION_ALL_PUBLIC = 3
17 SELECTION_ALL_PROTECTED = 4
18 
19 PERMISSIONS = (
20     # Translators: Permission name
21     ("billing.view", gettext_noop("View billing info")),
22     # Translators: Permission name
23     ("change.download", gettext_noop("Download changes")),
24     # Translators: Permission name
25     ("comment.add", gettext_noop("Post comment")),
26     # Translators: Permission name
27     ("comment.delete", gettext_noop("Delete comment")),
28     # Translators: Permission name
29     ("comment.resolve", gettext_noop("Resolve comment")),
30     # Translators: Permission name
31     ("component.edit", gettext_noop("Edit component settings")),
32     # Translators: Permission name
33     ("component.lock", gettext_noop("Lock component, preventing translations")),
34     # Translators: Permission name
35     ("glossary.add", gettext_noop("Add glossary entry")),
36     # Translators: Permission name
37     ("glossary.edit", gettext_noop("Edit glossary entry")),
38     # Translators: Permission name
39     ("glossary.delete", gettext_noop("Delete glossary entry")),
40     # Translators: Permission name
41     ("glossary.upload", gettext_noop("Upload glossary entries")),
42     # Translators: Permission name
43     ("machinery.view", gettext_noop("Use automatic suggestions")),
44     # Translators: Permission name
45     ("memory.edit", gettext_noop("Edit translation memory")),
46     # Translators: Permission name
47     ("memory.delete", gettext_noop("Delete translation memory")),
48     # Translators: Permission name
49     ("project.edit", gettext_noop("Edit project settings")),
50     # Translators: Permission name
51     ("project.permissions", gettext_noop("Manage project access")),
52     # Translators: Permission name
53     ("reports.view", gettext_noop("Download reports")),
54     # Translators: Permission name
55     ("screenshot.add", gettext_noop("Add screenshot")),
56     # Translators: Permission name
57     ("screenshot.edit", gettext_noop("Edit screenshot")),
58     # Translators: Permission name
59     ("screenshot.delete", gettext_noop("Delete screenshot")),
60     # Translators: Permission name
61     ("source.edit", gettext_noop("Edit additional string info")),
62     # Translators: Permission name
63     ("unit.add", gettext_noop("Add new string")),
64     # Translators: Permission name
65     ("unit.delete", gettext_noop("Remove a string")),
66     # Translators: Permission name
67     ("unit.check", gettext_noop("Dismiss failing check")),
68     # Translators: Permission name
69     ("unit.edit", gettext_noop("Edit strings")),
70     # Translators: Permission name
71     ("unit.review", gettext_noop("Review strings")),
72     # Translators: Permission name
73     ("unit.override", gettext_noop("Edit string when suggestions are enforced")),
74     # Translators: Permission name
75     ("unit.template", gettext_noop("Edit source strings")),
76     # Translators: Permission name
77     ("suggestion.accept", gettext_noop("Accept suggestion")),
78     # Translators: Permission name
79     ("suggestion.add", gettext_noop("Add suggestion")),
80     # Translators: Permission name
81     ("suggestion.delete", gettext_noop("Delete suggestion")),
82     # Translators: Permission name
83     ("suggestion.vote", gettext_noop("Vote on suggestion")),
84     # Translators: Permission name
85     ("translation.add", gettext_noop("Add language for translation")),
86     # Translators: Permission name
87     ("translation.auto", gettext_noop("Perform automatic translation")),
88     # Translators: Permission name
89     ("translation.delete", gettext_noop("Delete existing translation")),
90     # Translators: Permission name
91     ("translation.download", gettext_noop("Download translation file")),
92     # Translators: Permission name
93     ("translation.add_more", gettext_noop("Add several languages for translation")),
94     # Translators: Permission name
95     ("upload.authorship", gettext_noop("Define author of uploaded translation")),
96     # Translators: Permission name
97     ("upload.overwrite", gettext_noop("Overwrite existing strings with upload")),
98     # Translators: Permission name
99     ("upload.perform", gettext_noop("Upload translations")),
100     # Translators: Permission name
101     ("vcs.access", gettext_noop("Access the internal repository")),
102     # Translators: Permission name
103     ("vcs.commit", gettext_noop("Commit changes to the internal repository")),
104     # Translators: Permission name
105     ("vcs.push", gettext_noop("Push change from the internal repository")),
106     # Translators: Permission name
107     ("vcs.reset", gettext_noop("Reset changes in the internal repository")),
108     # Translators: Permission name
109     ("vcs.view", gettext_noop("View upstream repository location")),
110     # Translators: Permission name
111     ("vcs.update", gettext_noop("Update the internal repository")),
112 )
113 
114 PERMISSION_NAMES = {perm[0] for perm in PERMISSIONS}
115 
116 # Permissions which are not scoped per project
117 GLOBAL_PERMISSIONS = (
118     # Translators: Permission name
119     ("management.use", gettext_noop("Use management interface")),
120     # Translators: Permission name
121     ("project.add", gettext_noop("Add new projects")),
122     # Translators: Permission name
123     ("language.add", gettext_noop("Add language definitions")),
124     # Translators: Permission name
125     ("language.edit", gettext_noop("Manage language definitions")),
126     # Translators: Permission name
127     ("group.edit", gettext_noop("Manage teams")),
128     # Translators: Permission name
129     ("user.edit", gettext_noop("Manage users")),
130     # Translators: Permission name
131     ("role.edit", gettext_noop("Manage roles")),
132     # Translators: Permission name
133     ("announcement.edit", gettext_noop("Manage announcements")),
134     # Translators: Permission name
135     ("memory.edit", gettext_noop("Manage translation memory")),
136     # Translators: Permission name
137     ("machinery.edit", gettext_noop("Manage machinery")),
138     # Translators: Permission name
139     ("componentlist.edit", gettext_noop("Manage component lists")),
140 )
141 
142 GLOBAL_PERM_NAMES = {perm[0] for perm in GLOBAL_PERMISSIONS}
143 
144 
145 def filter_perms(prefix: str, exclude: set | None = None):
146     """Filter permission based on prefix."""
147     result = {perm[0] for perm in PERMISSIONS if perm[0].startswith(prefix)}
148     if exclude:
149         result = result.difference(exclude)
150     return result
151 
152 
153 # Translator permissions
154 TRANSLATE_PERMS = {
155     "comment.add",
156     "suggestion.accept",
157     "suggestion.add",
158     "suggestion.vote",
159     "unit.check",
160     "unit.edit",
161     "translation.download",
162     "upload.overwrite",
163     "upload.perform",
164     "machinery.view",
165 }
166 
167 # Default set of roles
168 ROLES = (
169     (
170         pgettext_noop("Access-control role", "Administration"),
171         [x[0] for x in PERMISSIONS],
172     ),
173     (
174         pgettext_noop("Access-control role", "Edit source"),
175         TRANSLATE_PERMS | {"unit.template", "source.edit"},
176     ),
177     (pgettext_noop("Access-control role", "Add suggestion"), {"suggestion.add"}),
178     (
179         pgettext_noop("Access-control role", "Access repository"),
180         {"translation.download", "vcs.access", "vcs.view"},
181     ),
182     (
183         pgettext_noop("Access-control role", "Manage glossary"),
184         filter_perms("glossary."),
185     ),
186     (
187         pgettext_noop("Access-control role", "Power user"),
188         TRANSLATE_PERMS
189         | {
190             "translation.add",
191             "unit.template",
192             "suggestion.delete",
193             "vcs.access",
194             "vcs.view",
195         }
196         | filter_perms("glossary."),
197     ),
198     (
199         pgettext_noop("Access-control role", "Review strings"),
200         TRANSLATE_PERMS | {"unit.review", "unit.override", "comment.resolve"},
201     ),
202     (pgettext_noop("Access-control role", "Translate"), TRANSLATE_PERMS),
203     (
204         pgettext_noop("Access-control role", "Manage languages"),
205         filter_perms("translation.", {"translation.auto"}),
206     ),
207     (
208         pgettext_noop("Access-control role", "Automatic translation"),
209         {"translation.auto"},
210     ),
211     (
212         pgettext_noop("Access-control role", "Manage translation memory"),
213         filter_perms("memory."),
214     ),
215     (
216         pgettext_noop("Access-control role", "Manage screenshots"),
217         filter_perms("screenshot."),
218     ),
219     (pgettext_noop("Access-control role", "Manage repository"), filter_perms("vcs.")),
220     (pgettext_noop("Access-control role", "Billing"), filter_perms("billing.")),
221 )
222 
223 # Default set of roles for groups
224 GROUPS = (
225     (
226         pgettext_noop("Access-control group", "Guests"),
227         ("Add suggestion", "Access repository"),
228         SELECTION_ALL_PUBLIC,
229     ),
230     (pgettext_noop("Access-control group", "Viewers"), (), SELECTION_ALL_PROTECTED),
231     (
232         pgettext_noop("Access-control group", "Users"),
233         ("Power user",),
234         SELECTION_ALL_PUBLIC,
235     ),
236     (
237         pgettext_noop("Access-control group", "Reviewers"),
238         ("Review strings",),
239         SELECTION_ALL,
240     ),
241     (
242         pgettext_noop("Access-control group", "Managers"),
243         ("Administration",),
244         SELECTION_ALL,
245     ),
246 )
247 
248 # Per project group definitions
249 ACL_GROUPS = {
250     pgettext_noop(
251         "Per-project access-control group", "Administration"
252     ): "Administration",
253     pgettext_noop("Per-project access-control group", "Review"): "Review strings",
254     pgettext_noop("Per-project access-control group", "Translate"): "Translate",
255     pgettext_noop("Per-project access-control group", "Sources"): "Edit source",
256     pgettext_noop("Per-project access-control group", "Languages"): "Manage languages",
257     pgettext_noop("Per-project access-control group", "Glossary"): "Manage glossary",
258     pgettext_noop(
259         "Per-project access-control group", "Memory"
260     ): "Manage translation memory",
261     pgettext_noop(
262         "Per-project access-control group", "Screenshots"
263     ): "Manage screenshots",
264     pgettext_noop(
265         "Per-project access-control group", "Automatic translation"
266     ): "Automatic translation",
267     pgettext_noop("Per-project access-control group", "VCS"): "Manage repository",
268     pgettext_noop("Per-project access-control group", "Billing"): "Billing",
269 }
270
```
--- 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()

```

diff --git a/weblate/auth/data.py b/weblate/auth/data.py
--- a/weblate/auth/data.py
+++ b/weblate/auth/data.py
@@ -218,6 +218,7 @@
     ),
     (pgettext_noop("Access-control role", "Manage repository"), filter_perms("vcs.")),
     (pgettext_noop("Access-control role", "Billing"), filter_perms("billing.")),
+    (pgettext_noop("Access-control role", "Add new projects"), {"project.add"}),
 )
 
 # Default set of roles for groups
@@ -243,6 +244,11 @@
         ("Administration",),
         SELECTION_ALL,
     ),
+    (
+        pgettext_noop("Access-control group", "Project creators"),
+        ("Add new projects",),
+        SELECTION_ALL,
+    ),
 )
 
 # Per project group definitions

{"golden_diff": "diff --git a/weblate/auth/data.py b/weblate/auth/data.py\n--- a/weblate/auth/data.py\n+++ b/weblate/auth/data.py\n@@ -218,6 +218,7 @@\n     ),\n     (pgettext_noop(\"Access-control role\", \"Manage repository\"), filter_perms(\"vcs.\")),\n     (pgettext_noop(\"Access-control role\", \"Billing\"), filter_perms(\"billing.\")),\n+    (pgettext_noop(\"Access-control role\", \"Add new projects\"), {\"project.add\"}),\n )\n \n # Default set of roles for groups\n@@ -243,6 +244,11 @@\n         (\"Administration\",),\n         SELECTION_ALL,\n     ),\n+    (\n+        pgettext_noop(\"Access-control group\", \"Project creators\"),\n+        (\"Add new projects\",),\n+        SELECTION_ALL,\n+    ),\n )\n \n # Per project group definitions\n", "issue": "Site-wide project creation permission\n### Describe the problem\n\nWith https://github.com/WeblateOrg/weblate/issues/263 there needs to be a way to grant users creating a project. Currently, there are two approaches depending on the server settings \u2013 either via billing limits, or by site-wide permission.\n\n### Describe the solution you'd like\n\nAdd role with the side-wide permission so that it can be easily assigned to the users.\n\n### Describe alternatives you've considered\n\n_No response_\n\n### Screenshots\n\n_No response_\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "# Copyright \u00a9 Michal \u010ciha\u0159 <michal@weblate.org>\n#\n# SPDX-License-Identifier: GPL-3.0-or-later\n\n\"\"\"Definition of permissions and default roles and groups.\"\"\"\n\nfrom __future__ import annotations\n\nfrom django.utils.translation import gettext_noop\n\nfrom weblate.utils.translation import pgettext_noop\n\nSELECTION_MANUAL = 0\nSELECTION_ALL = 1\nSELECTION_COMPONENT_LIST = 2\nSELECTION_ALL_PUBLIC = 3\nSELECTION_ALL_PROTECTED = 4\n\nPERMISSIONS = (\n    # Translators: Permission name\n    (\"billing.view\", gettext_noop(\"View billing info\")),\n    # Translators: Permission name\n    (\"change.download\", gettext_noop(\"Download changes\")),\n    # Translators: Permission name\n    (\"comment.add\", gettext_noop(\"Post comment\")),\n    # Translators: Permission name\n    (\"comment.delete\", gettext_noop(\"Delete comment\")),\n    # Translators: Permission name\n    (\"comment.resolve\", gettext_noop(\"Resolve comment\")),\n    # Translators: Permission name\n    (\"component.edit\", gettext_noop(\"Edit component settings\")),\n    # Translators: Permission name\n    (\"component.lock\", gettext_noop(\"Lock component, preventing translations\")),\n    # Translators: Permission name\n    (\"glossary.add\", gettext_noop(\"Add glossary entry\")),\n    # Translators: Permission name\n    (\"glossary.edit\", gettext_noop(\"Edit glossary entry\")),\n    # Translators: Permission name\n    (\"glossary.delete\", gettext_noop(\"Delete glossary entry\")),\n    # Translators: Permission name\n    (\"glossary.upload\", gettext_noop(\"Upload glossary entries\")),\n    # Translators: Permission name\n    (\"machinery.view\", gettext_noop(\"Use automatic suggestions\")),\n    # Translators: Permission name\n    (\"memory.edit\", gettext_noop(\"Edit translation memory\")),\n    # Translators: Permission name\n    (\"memory.delete\", gettext_noop(\"Delete translation memory\")),\n    # Translators: Permission name\n    (\"project.edit\", gettext_noop(\"Edit project settings\")),\n    # Translators: Permission name\n    (\"project.permissions\", gettext_noop(\"Manage project access\")),\n    # Translators: Permission name\n    (\"reports.view\", gettext_noop(\"Download reports\")),\n    # Translators: Permission name\n    (\"screenshot.add\", gettext_noop(\"Add screenshot\")),\n    # Translators: Permission name\n    (\"screenshot.edit\", gettext_noop(\"Edit screenshot\")),\n    # Translators: Permission name\n    (\"screenshot.delete\", gettext_noop(\"Delete screenshot\")),\n    # Translators: Permission name\n    (\"source.edit\", gettext_noop(\"Edit additional string info\")),\n    # Translators: Permission name\n    (\"unit.add\", gettext_noop(\"Add new string\")),\n    # Translators: Permission name\n    (\"unit.delete\", gettext_noop(\"Remove a string\")),\n    # Translators: Permission name\n    (\"unit.check\", gettext_noop(\"Dismiss failing check\")),\n    # Translators: Permission name\n    (\"unit.edit\", gettext_noop(\"Edit strings\")),\n    # Translators: Permission name\n    (\"unit.review\", gettext_noop(\"Review strings\")),\n    # Translators: Permission name\n    (\"unit.override\", gettext_noop(\"Edit string when suggestions are enforced\")),\n    # Translators: Permission name\n    (\"unit.template\", gettext_noop(\"Edit source strings\")),\n    # Translators: Permission name\n    (\"suggestion.accept\", gettext_noop(\"Accept suggestion\")),\n    # Translators: Permission name\n    (\"suggestion.add\", gettext_noop(\"Add suggestion\")),\n    # Translators: Permission name\n    (\"suggestion.delete\", gettext_noop(\"Delete suggestion\")),\n    # Translators: Permission name\n    (\"suggestion.vote\", gettext_noop(\"Vote on suggestion\")),\n    # Translators: Permission name\n    (\"translation.add\", gettext_noop(\"Add language for translation\")),\n    # Translators: Permission name\n    (\"translation.auto\", gettext_noop(\"Perform automatic translation\")),\n    # Translators: Permission name\n    (\"translation.delete\", gettext_noop(\"Delete existing translation\")),\n    # Translators: Permission name\n    (\"translation.download\", gettext_noop(\"Download translation file\")),\n    # Translators: Permission name\n    (\"translation.add_more\", gettext_noop(\"Add several languages for translation\")),\n    # Translators: Permission name\n    (\"upload.authorship\", gettext_noop(\"Define author of uploaded translation\")),\n    # Translators: Permission name\n    (\"upload.overwrite\", gettext_noop(\"Overwrite existing strings with upload\")),\n    # Translators: Permission name\n    (\"upload.perform\", gettext_noop(\"Upload translations\")),\n    # Translators: Permission name\n    (\"vcs.access\", gettext_noop(\"Access the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.commit\", gettext_noop(\"Commit changes to the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.push\", gettext_noop(\"Push change from the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.reset\", gettext_noop(\"Reset changes in the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.view\", gettext_noop(\"View upstream repository location\")),\n    # Translators: Permission name\n    (\"vcs.update\", gettext_noop(\"Update the internal repository\")),\n)\n\nPERMISSION_NAMES = {perm[0] for perm in PERMISSIONS}\n\n# Permissions which are not scoped per project\nGLOBAL_PERMISSIONS = (\n    # Translators: Permission name\n    (\"management.use\", gettext_noop(\"Use management interface\")),\n    # Translators: Permission name\n    (\"project.add\", gettext_noop(\"Add new projects\")),\n    # Translators: Permission name\n    (\"language.add\", gettext_noop(\"Add language definitions\")),\n    # Translators: Permission name\n    (\"language.edit\", gettext_noop(\"Manage language definitions\")),\n    # Translators: Permission name\n    (\"group.edit\", gettext_noop(\"Manage teams\")),\n    # Translators: Permission name\n    (\"user.edit\", gettext_noop(\"Manage users\")),\n    # Translators: Permission name\n    (\"role.edit\", gettext_noop(\"Manage roles\")),\n    # Translators: Permission name\n    (\"announcement.edit\", gettext_noop(\"Manage announcements\")),\n    # Translators: Permission name\n    (\"memory.edit\", gettext_noop(\"Manage translation memory\")),\n    # Translators: Permission name\n    (\"machinery.edit\", gettext_noop(\"Manage machinery\")),\n    # Translators: Permission name\n    (\"componentlist.edit\", gettext_noop(\"Manage component lists\")),\n)\n\nGLOBAL_PERM_NAMES = {perm[0] for perm in GLOBAL_PERMISSIONS}\n\n\ndef filter_perms(prefix: str, exclude: set | None = None):\n    \"\"\"Filter permission based on prefix.\"\"\"\n    result = {perm[0] for perm in PERMISSIONS if perm[0].startswith(prefix)}\n    if exclude:\n        result = result.difference(exclude)\n    return result\n\n\n# Translator permissions\nTRANSLATE_PERMS = {\n    \"comment.add\",\n    \"suggestion.accept\",\n    \"suggestion.add\",\n    \"suggestion.vote\",\n    \"unit.check\",\n    \"unit.edit\",\n    \"translation.download\",\n    \"upload.overwrite\",\n    \"upload.perform\",\n    \"machinery.view\",\n}\n\n# Default set of roles\nROLES = (\n    (\n        pgettext_noop(\"Access-control role\", \"Administration\"),\n        [x[0] for x in PERMISSIONS],\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Edit source\"),\n        TRANSLATE_PERMS | {\"unit.template\", \"source.edit\"},\n    ),\n    (pgettext_noop(\"Access-control role\", \"Add suggestion\"), {\"suggestion.add\"}),\n    (\n        pgettext_noop(\"Access-control role\", \"Access repository\"),\n        {\"translation.download\", \"vcs.access\", \"vcs.view\"},\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage glossary\"),\n        filter_perms(\"glossary.\"),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Power user\"),\n        TRANSLATE_PERMS\n        | {\n            \"translation.add\",\n            \"unit.template\",\n            \"suggestion.delete\",\n            \"vcs.access\",\n            \"vcs.view\",\n        }\n        | filter_perms(\"glossary.\"),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Review strings\"),\n        TRANSLATE_PERMS | {\"unit.review\", \"unit.override\", \"comment.resolve\"},\n    ),\n    (pgettext_noop(\"Access-control role\", \"Translate\"), TRANSLATE_PERMS),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage languages\"),\n        filter_perms(\"translation.\", {\"translation.auto\"}),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Automatic translation\"),\n        {\"translation.auto\"},\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage translation memory\"),\n        filter_perms(\"memory.\"),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage screenshots\"),\n        filter_perms(\"screenshot.\"),\n    ),\n    (pgettext_noop(\"Access-control role\", \"Manage repository\"), filter_perms(\"vcs.\")),\n    (pgettext_noop(\"Access-control role\", \"Billing\"), filter_perms(\"billing.\")),\n)\n\n# Default set of roles for groups\nGROUPS = (\n    (\n        pgettext_noop(\"Access-control group\", \"Guests\"),\n        (\"Add suggestion\", \"Access repository\"),\n        SELECTION_ALL_PUBLIC,\n    ),\n    (pgettext_noop(\"Access-control group\", \"Viewers\"), (), SELECTION_ALL_PROTECTED),\n    (\n        pgettext_noop(\"Access-control group\", \"Users\"),\n        (\"Power user\",),\n        SELECTION_ALL_PUBLIC,\n    ),\n    (\n        pgettext_noop(\"Access-control group\", \"Reviewers\"),\n        (\"Review strings\",),\n        SELECTION_ALL,\n    ),\n    (\n        pgettext_noop(\"Access-control group\", \"Managers\"),\n        (\"Administration\",),\n        SELECTION_ALL,\n    ),\n)\n\n# Per project group definitions\nACL_GROUPS = {\n    pgettext_noop(\n        \"Per-project access-control group\", \"Administration\"\n    ): \"Administration\",\n    pgettext_noop(\"Per-project access-control group\", \"Review\"): \"Review strings\",\n    pgettext_noop(\"Per-project access-control group\", \"Translate\"): \"Translate\",\n    pgettext_noop(\"Per-project access-control group\", \"Sources\"): \"Edit source\",\n    pgettext_noop(\"Per-project access-control group\", \"Languages\"): \"Manage languages\",\n    pgettext_noop(\"Per-project access-control group\", \"Glossary\"): \"Manage glossary\",\n    pgettext_noop(\n        \"Per-project access-control group\", \"Memory\"\n    ): \"Manage translation memory\",\n    pgettext_noop(\n        \"Per-project access-control group\", \"Screenshots\"\n    ): \"Manage screenshots\",\n    pgettext_noop(\n        \"Per-project access-control group\", \"Automatic translation\"\n    ): \"Automatic translation\",\n    pgettext_noop(\"Per-project access-control group\", \"VCS\"): \"Manage repository\",\n    pgettext_noop(\"Per-project access-control group\", \"Billing\"): \"Billing\",\n}\n", "path": "weblate/auth/data.py"}], "after_files": [{"content": "# Copyright \u00a9 Michal \u010ciha\u0159 <michal@weblate.org>\n#\n# SPDX-License-Identifier: GPL-3.0-or-later\n\n\"\"\"Definition of permissions and default roles and groups.\"\"\"\n\nfrom __future__ import annotations\n\nfrom django.utils.translation import gettext_noop\n\nfrom weblate.utils.translation import pgettext_noop\n\nSELECTION_MANUAL = 0\nSELECTION_ALL = 1\nSELECTION_COMPONENT_LIST = 2\nSELECTION_ALL_PUBLIC = 3\nSELECTION_ALL_PROTECTED = 4\n\nPERMISSIONS = (\n    # Translators: Permission name\n    (\"billing.view\", gettext_noop(\"View billing info\")),\n    # Translators: Permission name\n    (\"change.download\", gettext_noop(\"Download changes\")),\n    # Translators: Permission name\n    (\"comment.add\", gettext_noop(\"Post comment\")),\n    # Translators: Permission name\n    (\"comment.delete\", gettext_noop(\"Delete comment\")),\n    # Translators: Permission name\n    (\"comment.resolve\", gettext_noop(\"Resolve comment\")),\n    # Translators: Permission name\n    (\"component.edit\", gettext_noop(\"Edit component settings\")),\n    # Translators: Permission name\n    (\"component.lock\", gettext_noop(\"Lock component, preventing translations\")),\n    # Translators: Permission name\n    (\"glossary.add\", gettext_noop(\"Add glossary entry\")),\n    # Translators: Permission name\n    (\"glossary.edit\", gettext_noop(\"Edit glossary entry\")),\n    # Translators: Permission name\n    (\"glossary.delete\", gettext_noop(\"Delete glossary entry\")),\n    # Translators: Permission name\n    (\"glossary.upload\", gettext_noop(\"Upload glossary entries\")),\n    # Translators: Permission name\n    (\"machinery.view\", gettext_noop(\"Use automatic suggestions\")),\n    # Translators: Permission name\n    (\"memory.edit\", gettext_noop(\"Edit translation memory\")),\n    # Translators: Permission name\n    (\"memory.delete\", gettext_noop(\"Delete translation memory\")),\n    # Translators: Permission name\n    (\"project.edit\", gettext_noop(\"Edit project settings\")),\n    # Translators: Permission name\n    (\"project.permissions\", gettext_noop(\"Manage project access\")),\n    # Translators: Permission name\n    (\"reports.view\", gettext_noop(\"Download reports\")),\n    # Translators: Permission name\n    (\"screenshot.add\", gettext_noop(\"Add screenshot\")),\n    # Translators: Permission name\n    (\"screenshot.edit\", gettext_noop(\"Edit screenshot\")),\n    # Translators: Permission name\n    (\"screenshot.delete\", gettext_noop(\"Delete screenshot\")),\n    # Translators: Permission name\n    (\"source.edit\", gettext_noop(\"Edit additional string info\")),\n    # Translators: Permission name\n    (\"unit.add\", gettext_noop(\"Add new string\")),\n    # Translators: Permission name\n    (\"unit.delete\", gettext_noop(\"Remove a string\")),\n    # Translators: Permission name\n    (\"unit.check\", gettext_noop(\"Dismiss failing check\")),\n    # Translators: Permission name\n    (\"unit.edit\", gettext_noop(\"Edit strings\")),\n    # Translators: Permission name\n    (\"unit.review\", gettext_noop(\"Review strings\")),\n    # Translators: Permission name\n    (\"unit.override\", gettext_noop(\"Edit string when suggestions are enforced\")),\n    # Translators: Permission name\n    (\"unit.template\", gettext_noop(\"Edit source strings\")),\n    # Translators: Permission name\n    (\"suggestion.accept\", gettext_noop(\"Accept suggestion\")),\n    # Translators: Permission name\n    (\"suggestion.add\", gettext_noop(\"Add suggestion\")),\n    # Translators: Permission name\n    (\"suggestion.delete\", gettext_noop(\"Delete suggestion\")),\n    # Translators: Permission name\n    (\"suggestion.vote\", gettext_noop(\"Vote on suggestion\")),\n    # Translators: Permission name\n    (\"translation.add\", gettext_noop(\"Add language for translation\")),\n    # Translators: Permission name\n    (\"translation.auto\", gettext_noop(\"Perform automatic translation\")),\n    # Translators: Permission name\n    (\"translation.delete\", gettext_noop(\"Delete existing translation\")),\n    # Translators: Permission name\n    (\"translation.download\", gettext_noop(\"Download translation file\")),\n    # Translators: Permission name\n    (\"translation.add_more\", gettext_noop(\"Add several languages for translation\")),\n    # Translators: Permission name\n    (\"upload.authorship\", gettext_noop(\"Define author of uploaded translation\")),\n    # Translators: Permission name\n    (\"upload.overwrite\", gettext_noop(\"Overwrite existing strings with upload\")),\n    # Translators: Permission name\n    (\"upload.perform\", gettext_noop(\"Upload translations\")),\n    # Translators: Permission name\n    (\"vcs.access\", gettext_noop(\"Access the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.commit\", gettext_noop(\"Commit changes to the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.push\", gettext_noop(\"Push change from the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.reset\", gettext_noop(\"Reset changes in the internal repository\")),\n    # Translators: Permission name\n    (\"vcs.view\", gettext_noop(\"View upstream repository location\")),\n    # Translators: Permission name\n    (\"vcs.update\", gettext_noop(\"Update the internal repository\")),\n)\n\nPERMISSION_NAMES = {perm[0] for perm in PERMISSIONS}\n\n# Permissions which are not scoped per project\nGLOBAL_PERMISSIONS = (\n    # Translators: Permission name\n    (\"management.use\", gettext_noop(\"Use management interface\")),\n    # Translators: Permission name\n    (\"project.add\", gettext_noop(\"Add new projects\")),\n    # Translators: Permission name\n    (\"language.add\", gettext_noop(\"Add language definitions\")),\n    # Translators: Permission name\n    (\"language.edit\", gettext_noop(\"Manage language definitions\")),\n    # Translators: Permission name\n    (\"group.edit\", gettext_noop(\"Manage teams\")),\n    # Translators: Permission name\n    (\"user.edit\", gettext_noop(\"Manage users\")),\n    # Translators: Permission name\n    (\"role.edit\", gettext_noop(\"Manage roles\")),\n    # Translators: Permission name\n    (\"announcement.edit\", gettext_noop(\"Manage announcements\")),\n    # Translators: Permission name\n    (\"memory.edit\", gettext_noop(\"Manage translation memory\")),\n    # Translators: Permission name\n    (\"machinery.edit\", gettext_noop(\"Manage machinery\")),\n    # Translators: Permission name\n    (\"componentlist.edit\", gettext_noop(\"Manage component lists\")),\n)\n\nGLOBAL_PERM_NAMES = {perm[0] for perm in GLOBAL_PERMISSIONS}\n\n\ndef filter_perms(prefix: str, exclude: set | None = None):\n    \"\"\"Filter permission based on prefix.\"\"\"\n    result = {perm[0] for perm in PERMISSIONS if perm[0].startswith(prefix)}\n    if exclude:\n        result = result.difference(exclude)\n    return result\n\n\n# Translator permissions\nTRANSLATE_PERMS = {\n    \"comment.add\",\n    \"suggestion.accept\",\n    \"suggestion.add\",\n    \"suggestion.vote\",\n    \"unit.check\",\n    \"unit.edit\",\n    \"translation.download\",\n    \"upload.overwrite\",\n    \"upload.perform\",\n    \"machinery.view\",\n}\n\n# Default set of roles\nROLES = (\n    (\n        pgettext_noop(\"Access-control role\", \"Administration\"),\n        [x[0] for x in PERMISSIONS],\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Edit source\"),\n        TRANSLATE_PERMS | {\"unit.template\", \"source.edit\"},\n    ),\n    (pgettext_noop(\"Access-control role\", \"Add suggestion\"), {\"suggestion.add\"}),\n    (\n        pgettext_noop(\"Access-control role\", \"Access repository\"),\n        {\"translation.download\", \"vcs.access\", \"vcs.view\"},\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage glossary\"),\n        filter_perms(\"glossary.\"),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Power user\"),\n        TRANSLATE_PERMS\n        | {\n            \"translation.add\",\n            \"unit.template\",\n            \"suggestion.delete\",\n            \"vcs.access\",\n            \"vcs.view\",\n        }\n        | filter_perms(\"glossary.\"),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Review strings\"),\n        TRANSLATE_PERMS | {\"unit.review\", \"unit.override\", \"comment.resolve\"},\n    ),\n    (pgettext_noop(\"Access-control role\", \"Translate\"), TRANSLATE_PERMS),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage languages\"),\n        filter_perms(\"translation.\", {\"translation.auto\"}),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Automatic translation\"),\n        {\"translation.auto\"},\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage translation memory\"),\n        filter_perms(\"memory.\"),\n    ),\n    (\n        pgettext_noop(\"Access-control role\", \"Manage screenshots\"),\n        filter_perms(\"screenshot.\"),\n    ),\n    (pgettext_noop(\"Access-control role\", \"Manage repository\"), filter_perms(\"vcs.\")),\n    (pgettext_noop(\"Access-control role\", \"Billing\"), filter_perms(\"billing.\")),\n    (pgettext_noop(\"Access-control role\", \"Add new projects\"), {\"project.add\"}),\n)\n\n# Default set of roles for groups\nGROUPS = (\n    (\n        pgettext_noop(\"Access-control group\", \"Guests\"),\n        (\"Add suggestion\", \"Access repository\"),\n        SELECTION_ALL_PUBLIC,\n    ),\n    (pgettext_noop(\"Access-control group\", \"Viewers\"), (), SELECTION_ALL_PROTECTED),\n    (\n        pgettext_noop(\"Access-control group\", \"Users\"),\n        (\"Power user\",),\n        SELECTION_ALL_PUBLIC,\n    ),\n    (\n        pgettext_noop(\"Access-control group\", \"Reviewers\"),\n        (\"Review strings\",),\n        SELECTION_ALL,\n    ),\n    (\n        pgettext_noop(\"Access-control group\", \"Managers\"),\n        (\"Administration\",),\n        SELECTION_ALL,\n    ),\n    (\n        pgettext_noop(\"Access-control group\", \"Project creators\"),\n        (\"Add new projects\",),\n        SELECTION_ALL,\n    ),\n)\n\n# Per project group definitions\nACL_GROUPS = {\n    pgettext_noop(\n        \"Per-project access-control group\", \"Administration\"\n    ): \"Administration\",\n    pgettext_noop(\"Per-project access-control group\", \"Review\"): \"Review strings\",\n    pgettext_noop(\"Per-project access-control group\", \"Translate\"): \"Translate\",\n    pgettext_noop(\"Per-project access-control group\", \"Sources\"): \"Edit source\",\n    pgettext_noop(\"Per-project access-control group\", \"Languages\"): \"Manage languages\",\n    pgettext_noop(\"Per-project access-control group\", \"Glossary\"): \"Manage glossary\",\n    pgettext_noop(\n        \"Per-project access-control group\", \"Memory\"\n    ): \"Manage translation memory\",\n    pgettext_noop(\n        \"Per-project access-control group\", \"Screenshots\"\n    ): \"Manage screenshots\",\n    pgettext_noop(\n        \"Per-project access-control group\", \"Automatic translation\"\n    ): \"Automatic translation\",\n    pgettext_noop(\"Per-project access-control group\", \"VCS\"): \"Manage repository\",\n    pgettext_noop(\"Per-project access-control group\", \"Billing\"): \"Billing\",\n}\n", "path": "weblate/auth/data.py"}]}