1 from PLC.Methods.GetKeys import GetKeys
3 class AdmGetPersonKeys(GetKeys):
5 Deprecated. Functionality can be implemented with GetPersons and
11 roles = ['admin', 'pi', 'user', 'tech']
15 Mixed(Person.fields['person_id'],
16 Person.fields['email']),
17 [Key.fields['key_id']]
20 returns = [Key.fields]
22 def call(auth, person_id_or_email):
23 # Get account information
24 persons = Persons(self.api, [person_id_or_email])
26 raise PLCInvalidArgument, "No such account"
28 person = persons.values()[0]
30 if 'admin' not in self.caller['roles']:
31 if self.caller['person_id'] != person['person_id']:
32 raise PLCPermissionDenied, "Not allowed to view keys for specified account"
34 return GetKeys.call(self, auth, person['key_ids'])