X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FDeleteKey.py;h=51c40d417ae6acad3cbb666e15f66516b047dfb8;hb=19d4a01ccf66af9e00914351b3eacd5fc880f988;hp=d3eb68d8a1861fca8805f6e6daa38b29db5e89ae;hpb=3ab53c5221664528325a0edc7ca40c57eb783428;p=plcapi.git diff --git a/PLC/Methods/DeleteKey.py b/PLC/Methods/DeleteKey.py index d3eb68d..51c40d4 100644 --- a/PLC/Methods/DeleteKey.py +++ b/PLC/Methods/DeleteKey.py @@ -29,13 +29,18 @@ class DeleteKey(Method): if not keys: raise PLCInvalidArgument, "No such key" key = keys[0] - PLCCheckLocalKey(key,"DeleteKey") + + if key['peer_id'] is not None: + raise PLCInvalidArgument, "Not a local key" if 'admin' not in self.caller['roles']: if key['key_id'] not in self.caller['key_ids']: raise PLCPermissionDenied, "Key must be associated with your account" key.delete() - self.object_ids = [key['key_id']] + + # Logging variables + self.event_objects = {'Key': [key['key_id']]} + self.message = 'Key %d deleted' % key['key_id'] return 1