X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FDeletePerson.py;h=448f8085ee188a551d3afc6b8cd7c2ec7dbedc5c;hb=3daa504f34faa18a1a399662e237d236e5ec2ae4;hp=38534c7143ed5aa6c9a5e0c83cd13928dc9da071;hpb=d4c363a3ee55334eacd91f303adf6ecc20055d1e;p=plcapi.git diff --git a/PLC/Methods/DeletePerson.py b/PLC/Methods/DeletePerson.py index 38534c7..448f808 100644 --- a/PLC/Methods/DeletePerson.py +++ b/PLC/Methods/DeletePerson.py @@ -25,15 +25,16 @@ class DeletePerson(Method): returns = Parameter(int, '1 if successful') - def call(self, auth, person_id_or_email): # Get account information persons = Persons(self.api, [person_id_or_email]) if not persons: raise PLCInvalidArgument, "No such account" - person = persons[0] + if person['peer_id'] is not None: + raise PLCInvalidArgument, "Not a local account" + # Authenticated function assert self.caller is not None @@ -42,6 +43,9 @@ class DeletePerson(Method): raise PLCPermissionDenied, "Not allowed to delete specified account" person.delete() - self.object_ids = [person['person_id']] + + # Logging variables + self.event_objects = {'Person': [person['person_id']]} + self.message = 'Person %d deleted' % person['person_id'] return 1