fix permission error when creating slices with tenant view
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index 46c22b3..bb06e6b 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -67,7 +67,14 @@
# only admins change a slice's creator
if 'creator' in self.changed_fields and \
(not hasattr(self, 'caller') or not self.caller.is_admin):
- raise PermissionDenied("Insufficient privileges to change slice creator")
+
+ if (self._initial["creator"]==None): # and (self.creator==self.caller):
+ # it's okay if the creator is being set by the caller to
+ # himeself on a new slice object.
+ # TODO: self.caller is None when called from slicePlus REST API
+ pass
+ else:
+ raise PermissionDenied("Insufficient privileges to change slice creator")
if not self.creator:
raise ValidationError('slice has no creator')