- if not admin, only return
authorTony Mack <tmack@cs.princeton.edu>
Thu, 12 Jul 2007 17:59:10 +0000 (17:59 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Thu, 12 Jul 2007 17:59:10 +0000 (17:59 +0000)
1) nodes without a whitelist
2) nodes with whitelist when users slice is on the whitelist

PLC/Methods/GetNodes.py

index d308a4f..6c0cd62 100644 (file)
@@ -37,7 +37,13 @@ class GetNodes(Method):
         # Remove admin only fields
         if not isinstance(self.caller, Person) or \
            'admin' not in self.caller['roles']:
+           slice_ids = set(self.caller['slice_ids'])
             for node in nodes:
+               # if node has whitelist, make sure the user has a slice on the whitelist 
+               if node['slice_ids_whitelist'] and \
+                  not slice_ids.intersection(node['slice_ids_whitelist']):
+                   nodes.remove(node)
+                   continue 
                 for field in ['boot_nonce', 'key', 'session', 'root_person_ids']:
                     if field in node:
                         del node[field]