3f0780caf2da3d34cd9a6e11279d05afaae36e61
[plcapi.git] / PLC / Methods / SliceUserDel.py
1 # $Id$
2 from PLC.Faults import *
3 from PLC.Method import Method
4 from PLC.Parameter import Parameter, Mixed
5 from PLC.Auth import Auth
6 from PLC.Persons import Person, Persons
7 from PLC.Slices import Slice, Slices
8 from PLC.Methods.DeletePersonFromSlice import DeletePersonFromSlice
9
10 class SliceUserDel(Method):
11     """
12     Deprecated. Can be implemented with DeletePersonFromSlice.
13
14     Removes the specified users from the specified slice. If the person is
15     already a member of the slice, no errors are returned. 
16
17     Returns 1 if successful, faults otherwise.
18     """
19
20     status = "deprecated"
21
22     roles = ['admin', 'pi']
23
24     accepts = [
25         Auth(),
26         Slice.fields['name'],
27         [Person.fields['email']],
28         ]
29
30     returns = Parameter(int, '1 if successful')
31
32     def call(self, auth, slice_name, user_list):
33         for user in user_list:
34             DeletePersonFromSlice.call(self, auth, user, slice_name)
35
36         return 1