X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=PLC%2FMethods%2FDeletePersonFromSlice.py;h=9bab6abd950ee011c68d812e21a213c59179bfb2;hb=2c63f41e29a7ae2cea6546c06a1838a6fc2daccf;hp=4ccf40aa706b8d71156e00702691ed2ee4e119ef;hpb=3f30de17c58880c0f6f1d64ea573c3fe56e32a38;p=plcapi.git diff --git a/PLC/Methods/DeletePersonFromSlice.py b/PLC/Methods/DeletePersonFromSlice.py index 4ccf40a..9bab6ab 100644 --- a/PLC/Methods/DeletePersonFromSlice.py +++ b/PLC/Methods/DeletePersonFromSlice.py @@ -25,24 +25,28 @@ class DeletePersonFromSlice(Method): returns = Parameter(int, '1 if successful') - event_type = 'DeleteFrom' object_type = 'Slice' + def call(self, auth, person_id_or_email, slice_id_or_name): # Get account information persons = Persons(self.api, [person_id_or_email]) if not persons: raise PLCInvalidArgument, "No such account" - person = persons[0] # Get slice information slices = Slices(self.api, [slice_id_or_name]) if not slices: raise PLCInvalidArgument, "No such slice" - slice = slices[0] + # N.B. Allow foreign users to be added to local slices and + # local users to be added to foreign slices (and, of course, + # local users to be added to local slices). + if person['peer_id'] is not None and slice['peer_id'] is not None: + raise PLCInvalidArgument, "Cannot delete foreign users from foreign slices" + # If we are not admin, make sure the caller is a pi # of the site associated with the slice if 'admin' not in self.caller['roles']: