ability for sliceview to display user slices instead of authority slices
[sface.git] / sface / sfidata.py
index 315fddc..fb98ac5 100644 (file)
@@ -3,7 +3,7 @@ from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
 from lxml import etree
-from sfa.util.record import SfaRecord, SliceRecord, AuthorityRecord
+from sfa.util.record import SfaRecord, SliceRecord, AuthorityRecord, UserRecord
 from sfa.rspecs.rspec_parser import parse_rspec
 from sface.config import config
 
@@ -35,6 +35,22 @@ class SfiData:
             return rec
         return None
 
+    def getUserRecord(self):
+        rec_file = config.getUserRecordFile()
+        if os.path.exists(rec_file):
+            xml = open(rec_file).read()
+            rec = UserRecord()
+            rec.load_from_string(xml)
+            return rec
+        return None
+
+    def getUserSliceHrns(self):
+        rec = self.getUserRecord()
+        if rec:
+            return rec.get_field("slices")
+
+        return []
+
     def purgeNonSliceResources(self, rspec):
         # This can probably go away once the new slice manager is fully
         # deployed.