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 Auth
7 can_update = lambda (field, value): field in \
10 class UpdateKey(Method):
12 Updates the parameters of an existing key with the values in
15 Non-admins may only update their own keys.
17 Returns 1 if successful, faults otherwise.
20 roles = ['admin', 'pi', 'tech', 'user']
22 key_fields = dict(filter(can_update, Key.fields.items()))
30 returns = Parameter(int, '1 if successful')
32 def call(self, auth, key_id, key_fields):