- call GetSlices and GetPersons
[plcapi.git] / PLC / Methods / SetPersonPrimarySite.py
index e2e913f..86e96c9 100644 (file)
@@ -10,7 +10,7 @@ class SetPersonPrimarySite(Method):
     Makes the specified site the person's primary site. The person
     must already be a member of the site.
 
-    ins may update anyone. All others may only update themselves.
+    Admins may update anyone. All others may only update themselves.
     """
 
     roles = ['admin', 'pi', 'user', 'tech']
@@ -30,9 +30,10 @@ class SetPersonPrimarySite(Method):
         persons = Persons(self.api, [person_id_or_email])
         if not persons:
             raise PLCInvalidArgument, "No such account"
-
         person = persons[0]
-       PLCCheckLocalPerson(person,"SetPersonPrimarySite")
+
+        if person['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local account"
 
         # Authenticated function
         assert self.caller is not None
@@ -46,9 +47,10 @@ class SetPersonPrimarySite(Method):
         sites = Sites(self.api, [site_id_or_login_base])
         if not sites:
             raise PLCInvalidArgument, "No such site"
-
         site = sites[0]
-       PLCCheckLocalSite(site,"SetPersonPrimarySite")
+
+        if site['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local site"
 
         if site['site_id'] not in person['site_ids']:
             raise PLCInvalidArgument, "Not a member of the specified site"