X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAddPersonKey.py;h=5212b44c7b920ee486039b0a4dbce5198c3525d7;hb=72f34552c9d6f81c6f0789ff03b07f2e7c34efa0;hp=3c7fc976276b603408ed72d04f86aa01342fe105;hpb=42e3cc9aa14d211bfbf2e3c911c5927aedc79301;p=plcapi.git diff --git a/PLC/Methods/AddPersonKey.py b/PLC/Methods/AddPersonKey.py index 3c7fc97..5212b44 100644 --- a/PLC/Methods/AddPersonKey.py +++ b/PLC/Methods/AddPersonKey.py @@ -1,3 +1,5 @@ +# $Id$ +# $URL$ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed @@ -29,9 +31,6 @@ class AddPersonKey(Method): returns = Parameter(int, 'New key_id (> 0) if successful') - object_type = 'Person' - - def call(self, auth, person_id_or_email, key_fields): key_fields = dict(filter(can_update, key_fields.items())) @@ -44,7 +43,7 @@ class AddPersonKey(Method): if person['peer_id'] is not None: raise PLCInvalidArgument, "Not a local account" - # If we are not admin, make sure caller is adding a key to their account + # If we are not admin, make sure caller is adding a key to their account if 'admin' not in self.caller['roles']: if person['person_id'] != self.caller['person_id']: raise PLCPermissionDenied, "You may only modify your own keys" @@ -54,8 +53,9 @@ class AddPersonKey(Method): person.add_key(key, commit = True) # Logging variables - self.object_ids = [person['person_id'], key['key_id']] - self.message = 'Key %d added to person %d' % \ - (key['key_id'], person['person_id']) + self.event_objects = {'Person': [person['person_id']], + 'Key': [key['key_id']]} + self.message = 'Key %d added to person %d' % \ + (key['key_id'], person['person_id']) return key['key_id']