1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Keys import Key, Keys
5 from PLC.Auth import PasswordAuth
9 Return an array of structs containing details about keys. If
10 key_id_list is specified, only the specified keys will be queried.
12 Admin may query all keys. Non-admins may only query their own
16 roles = ['admin', 'pi', 'user', 'tech']
20 [Key.fields['key_id']]
23 returns = [Key.fields]
25 def call(self, auth, key_ids = None):
26 # If we are not admin, make sure to only return our own keys
27 if 'admin' not in self.caller['roles']:
28 key_ids = set(key_ids).intersection(self.caller['key_ids'])
32 return Keys(self.api, key_ids).values()