class DeleteKey(Method):
"""
- Deletes a Key.
+ Deletes a key.
Non-admins may only delete their own keys.
returns = Parameter(int, '1 if successful')
def call(self, auth, key_id):
- # Get associated address details
+ # Get associated key details
keys = Keys(self.api, [key_id]).values()
if not keys:
raise PLCInvalidArgument, "No such 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 one your account"
+ raise PLCPermissionDenied, "Key must be associated with your account"
+ assert key['person_id'] == self.caller['person_id']
key.delete()