4 # Thierry Parmentelat - INRIA
7 from PLC.Faults import *
8 from PLC.Method import Method
9 from PLC.Parameter import Parameter, Mixed
10 from PLC.Filter import Filter
11 from PLC.Auth import Auth
13 from PLC.Persons import Person
14 from PLC.Peers import Peer, Peers
16 class GetPeers (Method):
18 Returns an array of structs containing details about peers. If
19 person_filter is specified and is an array of peer identifiers or
20 peer names, or a struct of peer attributes, only peers matching
21 the filter will be returned. If return_fields is specified, only the
22 specified details will be returned.
25 roles = ['admin', 'node','pi','user']
29 Mixed([Mixed(Peer.fields['peer_id'],
30 Peer.fields['peername'])],
32 Parameter([str], "List of fields to return", nullok = True)
35 returns = [Peer.fields]
37 def call (self, auth, peer_filter = None, return_fields = None):
39 peers = Peers(self.api, peer_filter, return_fields)
41 # Remove admin only fields
42 if not isinstance(self.caller, Person) or \
43 'admin' not in self.caller['roles']:
45 for field in ['key', 'cacert']: