From: Tony Mack Date: Thu, 12 Jul 2007 17:59:10 +0000 (+0000) Subject: - if not admin, only return X-Git-Tag: PLCAPI-4.2-0~109 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7138589109a02438a8e978dbd0684a1df63c4e55;p=plcapi.git - if not admin, only return 1) nodes without a whitelist 2) nodes with whitelist when users slice is on the whitelist --- diff --git a/PLC/Methods/GetNodes.py b/PLC/Methods/GetNodes.py index d308a4f4..6c0cd62b 100644 --- a/PLC/Methods/GetNodes.py +++ b/PLC/Methods/GetNodes.py @@ -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]