- call DeletePersonFromSlice
authorTony Mack <tmack@cs.princeton.edu>
Tue, 16 Jan 2007 22:30:17 +0000 (22:30 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Tue, 16 Jan 2007 22:30:17 +0000 (22:30 +0000)
PLC/Methods/SliceUserDel.py

index 04c13fe..1cdafa8 100644 (file)
@@ -1,9 +1,10 @@
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
+from PLC.Auth import Auth
 from PLC.Persons import Person, Persons
 from PLC.Slices import Slice, Slices
-from PLC.Auth import Auth
+from PLC.Methods.DeletePersonFromSlice import DeletePersonFromSlice
 
 class SliceUserDel(Method):
     """
@@ -26,31 +27,7 @@ class SliceUserDel(Method):
     returns = Parameter(int, '1 if successful')
 
     def call(self, auth, slice_name, user_list):
-        # Get account information
-        persons = Persons(self.api, user_list)
-        if not persons:
-            raise PLCInvalidArgument, "No such account"
-
-        # Get slice information
-        slices = Slices(self.api, [slice_id_or_name])
-        if not slices:
-            raise PLCInvalidArgument, "No such slice"
-
-        slice = slices[0]
-       if slice['peer_id'] is not None:
-            raise PLCInvalidArgument, "Not a local slice"
-
-        # 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']:
-            if slice['site_id'] not in self.caller['site_ids']:
-                raise PLCPermissionDenied, "Not allowed to add users to this slice"
-       
-       for person in persons:
-           if person['person_id'] in slice['person_ids']:
-                slice.remove_person(person, False)
-       
-       slice.sync()
-       self.object_ids = [slice['slice_id']]
+       for user in user_list:
+           DeletePersonFromSlice.call(self, auth, user, slice_name)
 
         return 1