1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Persons import Person, Persons
5 from PLC.Sites import Site, Sites
6 from PLC.Auth import Auth
8 class DeletePersonFromSite(Method):
10 Removes the specified person from the specified site. If the
11 person is not a member of the specified site, no error is
14 Returns 1 if successful, faults otherwise.
21 Mixed(Person.fields['person_id'],
22 Person.fields['email']),
23 Mixed(Site.fields['site_id'],
24 Site.fields['login_base'])
27 returns = Parameter(int, '1 if successful')
29 event_type = 'DeleteFrom'
32 def call(self, auth, person_id_or_email, site_id_or_login_base):
33 # Get account information
34 persons = Persons(self.api, [person_id_or_email])
36 raise PLCInvalidArgument, "No such account"
40 # Get site information
41 sites = Sites(self.api, [site_id_or_login_base])
43 raise PLCInvalidArgument, "No such site"
47 if site['site_id'] in person['site_ids']:
48 site.remove_person(person)
50 self.object_ids = [site['site_id']]