pis can view slices at their sites
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index 1e7df5a..e474560 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -70,7 +70,12 @@
if user.is_admin:
qs = Slice.objects.all()
else:
+ # users can see slices they belong to
slice_ids = [sp.slice.id for sp in SlicePrivilege.objects.filter(user=user)]
+ # pis can see slices at their sites
+ sites = [sp.site for sp in SitePrivilege.objects.filter(user=user)\
+ if sp.role.role == 'pi']
+ slice_ids.extend([s.id for s in Slice.objects.filter(site__in=sites)])
qs = Slice.objects.filter(id__in=slice_ids)
return qs