On the frontend, only show hosts to which this user has ACL access.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1343 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 3c52180..27c2bc8 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -107,3 +107,16 @@
label = models.Label.smart_get(label)
return is_server, is_synchronous, test_objects, label
+
+
+def gather_unique_dicts(dict_iterable):
+ """\
+ Pick out unique objects (by ID) from an iterable of object dicts.
+ """
+ id_set = set()
+ result = []
+ for obj in dict_iterable:
+ if obj['id'] not in id_set:
+ id_set.add(obj['id'])
+ result.append(obj)
+ return result