from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
class DeletePersonFromSlice(Method):
"""
Deletes the specified person from the specified slice. If the person is
class DeletePersonFromSlice(Method):
"""
Deletes the specified person from the specified slice. If the person is
# Get account information
persons = Persons(self.api, [person_id_or_email])
if not persons:
# Get account information
persons = Persons(self.api, [person_id_or_email])
if not persons:
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:
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:
# If we are not admin, make sure the caller is a pi
# of the site associated with the 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 delete users from this slice"
+ if 'admin' not in self.caller['roles']:
+ if slice['site_id'] not in self.caller['site_ids']:
+ raise PLCPermissionDenied("Not allowed to delete users from slice %s"%slice_id_or_name)
-
- self.event_objects = {'Slice': [slice['slice_id']],
- 'Person': [person['person_id']]}
+
+ self.event_objects = {'Slice': [slice['slice_id']],
+ 'Person': [person['person_id']]}