66from django .db import models
77from django .conf import settings
88from pulpcore .plugin .models import (
9+ AutoAddObjPermsMixin ,
910 Content ,
1011 Publication ,
1112 Distribution ,
4748)
4849
4950
50- class PythonDistribution (Distribution ):
51+ class PythonDistribution (Distribution , AutoAddObjPermsMixin ):
5152 """
5253 Distribution for 'Python' Content.
5354 """
@@ -119,6 +120,9 @@ def content_handler(self, path):
119120
120121 class Meta :
121122 default_related_name = "%(app_label)s_%(model_name)s"
123+ permissions = [
124+ ("manage_roles_pythondistribution" , "Can manage roles on python distributions" ),
125+ ]
122126
123127
124128class NormalizeName (models .Transform ):
@@ -213,7 +217,7 @@ class Meta:
213217 unique_together = ("sha256" , "_pulp_domain" )
214218
215219
216- class PythonPublication (Publication ):
220+ class PythonPublication (Publication , AutoAddObjPermsMixin ):
217221 """
218222 A Publication for PythonContent.
219223 """
@@ -222,9 +226,12 @@ class PythonPublication(Publication):
222226
223227 class Meta :
224228 default_related_name = "%(app_label)s_%(model_name)s"
229+ permissions = [
230+ ("manage_roles_pythonpublication" , "Can manage roles on python publications" ),
231+ ]
225232
226233
227- class PythonRemote (Remote ):
234+ class PythonRemote (Remote , AutoAddObjPermsMixin ):
228235 """
229236 A Remote for Python Content.
230237
@@ -259,9 +266,12 @@ def get_remote_artifact_content_type(self, relative_path=None):
259266
260267 class Meta :
261268 default_related_name = "%(app_label)s_%(model_name)s"
269+ permissions = [
270+ ("manage_roles_pythonremote" , "Can manage roles on python remotes" ),
271+ ]
262272
263273
264- class PythonRepository (Repository ):
274+ class PythonRepository (Repository , AutoAddObjPermsMixin ):
265275 """
266276 Repository for "python" content.
267277 """
@@ -274,6 +284,12 @@ class PythonRepository(Repository):
274284
275285 class Meta :
276286 default_related_name = "%(app_label)s_%(model_name)s"
287+ permissions = [
288+ ("sync_pythonrepository" , "Can start a sync task" ),
289+ ("modify_pythonrepository" , "Can modify content of the repository" ),
290+ ("manage_roles_pythonrepository" , "Can manage roles on python repositories" ),
291+ ("repair_pythonrepository" , "Can repair repository versions" ),
292+ ]
277293
278294 def on_new_version (self , version ):
279295 """
0 commit comments