allow ContentProvider, CDNPrefix, OriginServer to be edited by ContentProvider users
diff --git a/xos/hpc/models.py b/xos/hpc/models.py
index c0f7ba9..80f4260 100644
--- a/xos/hpc/models.py
+++ b/xos/hpc/models.py
@@ -89,6 +89,14 @@
# filtering of visible objects by user.
return qs.filter(serviceProvider__hpcService=hpcService)
+ def can_update(self, user):
+ if super(ContentProvider, self).can_update(user):
+ return True
+
+ if user in self.users.all():
+ return True
+
+ return False
class OriginServer(PlCoreBase):
class Meta:
@@ -113,6 +121,15 @@
# filtering of visible objects by user.
return qs.filter(contentProvider__serviceProvider__hpcService=hpcService)
+ def can_update(self, user):
+ if super(OriginServer, self).can_update(user):
+ return True
+
+ if self.contentProvider and self.contentProvider.can_update(user):
+ return True
+
+ return False
+
class CDNPrefix(PlCoreBase):
class Meta:
app_label = "hpc"
@@ -133,6 +150,15 @@
# filtering of visible objects by user.
return qs.filter(contentProvider__serviceProvider__hpcService=hpcService)
+ def can_update(self, user):
+ if super(CDNPrefix, self).can_update(user):
+ return True
+
+ if self.contentProvider and self.contentProvider.can_update(user):
+ return True
+
+ return False
+
class AccessMap(PlCoreBase):
class Meta:
app_label = "hpc"