X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=PLC%2FMethods%2FDeletePerson.py;h=448f8085ee188a551d3afc6b8cd7c2ec7dbedc5c;hb=3daa504f34faa18a1a399662e237d236e5ec2ae4;hp=2a6e8cc59c504eea71745b9885d4267e19c89d1a;hpb=1f8c38dd1357c93e4be8d94456b7274a591d2db4;p=plcapi.git diff --git a/PLC/Methods/DeletePerson.py b/PLC/Methods/DeletePerson.py index 2a6e8cc..448f808 100644 --- a/PLC/Methods/DeletePerson.py +++ b/PLC/Methods/DeletePerson.py @@ -30,8 +30,10 @@ class DeletePerson(Method): persons = Persons(self.api, [person_id_or_email]) if not persons: raise PLCInvalidArgument, "No such account" + person = persons[0] - person = persons.values()[0] + if person['peer_id'] is not None: + raise PLCInvalidArgument, "Not a local account" # Authenticated function assert self.caller is not None @@ -41,5 +43,9 @@ class DeletePerson(Method): raise PLCPermissionDenied, "Not allowed to delete specified account" person.delete() + + # Logging variables + self.event_objects = {'Person': [person['person_id']]} + self.message = 'Person %d deleted' % person['person_id'] return 1