factor out the privilege processing code
diff --git a/xos/tosca/resources/slice.py b/xos/tosca/resources/slice.py
index e4b7ba3..2b22ae7 100644
--- a/xos/tosca/resources/slice.py
+++ b/xos/tosca/resources/slice.py
@@ -38,14 +38,7 @@
 
         rolemap = ( ("tosca.relationships.AdminPrivilege", "admin"), ("tosca.relationships.AccessPrivilege", "access"),
                     ("tosca.relationships.PIPrivilege", "pi"), ("tosca.relationships.TechPrivilege", "tech") )
-        for (rel, role) in rolemap:
-            for email in self.get_requirements(rel):
-                role = self.get_xos_object(SliceRole, role=role)
-                user = self.get_xos_object(User, email=email)
-                if not SlicePrivilege.objects.filter(user=user, role=role, slice=obj):
-                    sp = SlicePrivilege(user=user, role=role, slice=obj)
-                    sp.save()
-                    self.info("Added slice privilege on %s role %s for %s" % (str(obj), str(role), str(user)))
+        self.postprocess_privileges(SliceRole, SlicePrivilege, rolemap)
 
     def create(self):
         nodetemplate = self.nodetemplate
diff --git a/xos/tosca/resources/xosresource.py b/xos/tosca/resources/xosresource.py
index ef59485..fa0f7d9 100644
--- a/xos/tosca/resources/xosresource.py
+++ b/xos/tosca/resources/xosresource.py
@@ -85,6 +85,16 @@
     def can_delete(self, obj):
         return True
 
+    def postprocess_privileges(self, roleclass, privclass, rolemap):
+        for (rel, role) in rolemap:
+            for email in self.get_requirements(rel):
+                role = self.get_xos_object(roleclass, role=role)
+                user = self.get_xos_object(User, email=email)
+                if not privclass.objects.filter(user=user, role=role, slice=obj):
+                    sp = privclass(user=user, role=role, slice=obj)
+                    sp.save()
+                    self.info("Added privilege on %s role %s for %s" % (str(obj), str(role), str(user)))
+
     def postprocess(self, obj):
         pass