From 7138589109a02438a8e978dbd0684a1df63c4e55 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 12 Jul 2007 17:59:10 +0000 Subject: [PATCH] - if not admin, only return 1) nodes without a whitelist 2) nodes with whitelist when users slice is on the whitelist --- PLC/Methods/GetNodes.py | 6 ++++++ 1 file changed, 6 insertions(+) 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] -- 2.47.0