add getPersons function to plc handler
smbaker [Thu, 18 Oct 2012 01:09:44 +0000 (18:09 -0700)]
apps/gacks/gackshandler_plc.py

index c917963..ed9e330 100644 (file)
@@ -194,6 +194,21 @@ class GacksPLCHandler(GacksHandler):
 
                 self.plcServer.AddSliceTag(self.plcAuth, slicename, resDef.plcAttribute, resStr, hostName)
 
+    def getPersons(self, accountName):
+        self.connectToPlc()
+
+        slices = self.plcServer.GetSlices(self.plcAuth, {"name": accountName}, ["person_ids"])
+        if not slices:
+           return []
+
+        slice = slices[0]
+        if not slice["person_ids"]:
+           return []
+
+        persons = self.plcServer.GetPersons(self.plcAuth, slice["person_ids"], ["email"])
+
+        return persons
+
     def getNodes(self):
         self.connectToPlc()