本文整理汇总了Python中core.xoslib.objects.cordsubscriber.CordSubscriber.get_tenant_objects方法的典型用法代码示例。如果您正苦于以下问题:Python CordSubscriber.get_tenant_objects方法的具体用法?Python CordSubscriber.get_tenant_objects怎么用?Python CordSubscriber.get_tenant_objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.xoslib.objects.cordsubscriber.CordSubscriber
的用法示例。
在下文中一共展示了CordSubscriber.get_tenant_objects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def get(self, request, format=None):
instances=[]
for subscriber in CordSubscriber.get_tenant_objects().all():
for user in subscriber.users:
instances.append( serialize_user(subscriber, user) )
return Response(instances)
示例2: ssiddetail
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def ssiddetail(self, pk=None, ssid=None):
object_list = CordSubscriber.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) ]
if len(ssidmap)==0:
raise XOSNotFound("didn't find ssid %s" % str(ssid))
return Response( ssidmap[0] )
示例3: post
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def post(self, request, format=None):
data = request.DATA
subscriber = CordSubscriber.get_tenant_objects().get(id=int(data["subscriber"]))
user = subscriber.create_user(name=data["name"],
level=data["level"],
mac=data["mac"])
subscriber.save()
return Response(serialize_user(subscriber,user))
示例4: put
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def put(self, request, pk):
kwargs={}
if "name" in request.DATA:
kwargs["name"] = request.DATA["name"]
if "level" in request.DATA:
kwargs["level"] = request.DATA["level"]
if "mac" in request.DATA:
kwargs["mac"] = request.DATA["mac"]
parts = pk.split("-")
subscriber = CordSubscriber.get_tenant_objects().get(id=int(parts[0]))
user = subscriber.update_user(parts[1], **kwargs)
subscriber.save()
return Response(serialize_user(subscriber,user))
示例5: initdemo
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def initdemo(self, request):
object_list = CordSubscriber.get_tenant_objects().all()
# reset the parental controls in any existing demo vCPEs
for o in object_list:
if str(o.service_specific_id) in ["0", "1"]:
self.setup_demo_subscriber(o)
demo_subscribers = [o for o in object_list if o.is_demo_user]
if demo_subscribers:
return Response({"id": demo_subscribers[0].id})
subscriber = CordSubscriberRoot(service_specific_id=1234,
name="demo-subscriber",)
subscriber.is_demo_user = True
subscriber.save()
self.setup_demo_subscriber(subscriber)
return Response({"id": subscriber.id})
示例6: ssidlist
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def ssidlist(self, request):
object_list = CordSubscriber.get_tenant_objects().all()
ssidmap = [ {"service_specific_id": x.service_specific_id, "subscriber_id": x.id} for x in object_list ]
return Response({"ssidmap": ssidmap})
示例7: delete
# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
def delete(self, request, pk):
parts = pk.split("-")
subscriber = CordSubscriber.get_tenant_objects().get(id=int(parts[0]))
subscriber.delete_user(parts[1])
subscriber.save()
return Response("okay")