fix extra colon; reset all levels to PG_13 for demo clients in initdemo
diff --git a/xos/core/xoslib/methods/cordsubscriber.py b/xos/core/xoslib/methods/cordsubscriber.py
index 5742c9c..83dc916 100644
--- a/xos/core/xoslib/methods/cordsubscriber.py
+++ b/xos/core/xoslib/methods/cordsubscriber.py
@@ -311,9 +311,24 @@
subscriber.save()
return Response({service: getattr(subscriber, service_attr)})
+ def setup_demo_vcpe(self, voltTenant):
+ # nuke the users and start over
+ voltTenant.vcpe.users = []
+ voltTenant.vcpe.create_user(name="Mom's PC", mac="01020303040506", level="PG_13")
+ voltTenant.vcpe.create_user(name="Dad's PC", mac="01020304040507", level="PG_13")
+ voltTenant.vcpe.create_user(name="Jack's iPhone", mac="01020304050508", level="PG_13")
+ voltTenant.vcpe.create_user(name="Jill's iPad", mac="01020304050609", level="PG_13")
+ voltTenant.vcpe.save()
+
def initdemo(self, request):
object_list = VOLTTenant.get_tenant_objects().all()
+ # reset the parental controls in any existing demo vCPEs
+ for o in object_list:
+ if str(o.subscriber_specific_id) in ["0", "1"]:
+ if o.vcpe is not None:
+ self.setup_demo_vcpe(o)
+
demo_subscribers = [o for o in object_list if o.is_demo_user]
if demo_subscribers:
@@ -325,11 +340,7 @@
voltTenant.caller = User.objects.get(email="padmin@vicci.org")
voltTenant.save()
- voltTenant.vcpe.create_user(name="Mom's PC", mac="01020303040506", level="R")
- voltTenant.vcpe.create_user(name="Dad's PC", mac="01020304040507", level="R")
- voltTenant.vcpe.create_user(name="Jack's iPhone", mac="01020304050508", level="PG")
- voltTenant.vcpe.create_user(name="Jill's iPad", mac="01020304050609", level="G")
- voltTenant.vcpe.save()
+ self.setup_demo_vcpe(voltTenant)
return Response({"id": voltTenant.id})
@@ -343,7 +354,7 @@
def ssiddetail(self, pk=None, ssid=None):
object_list = VOLTTenant.get_tenant_objects().all()
- ssidmap = [ {"service_specific_id:": x.service_specific_id, "subscriber_id": x.id} for x in object_list if str(x.service_specific_id)==str(ssid) ]
+ ssidmap = [ {"service_specific_id": x.service_specific_id, "subscriber_id": x.id} for x in object_list if str(x.service_specific_id)==str(ssid) ]
if len(ssidmap)==0:
raise XOSNotFound("didn't find ssid %s" % str(ssid))