from PLC.Parameter import Parameter, Mixed
from PLC.Persons import Person, Persons
from PLC.Sites import Site, Sites
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
class AdmGetPersonSites(Method):
"""
+ Deprecated. See GetPersons.
+
Returns the sites that the specified person is associated with as
an array of site identifiers.
themselves and others at their sites.
"""
+ status = "deprecated"
+
roles = ['admin', 'pi', 'user', 'tech']
accepts = [
- PasswordAuth(),
+ Auth(),
Mixed(Person.fields['person_id'],
Person.fields['email'])
]
- returns = [Site.fields['site_id']]
+ returns = Person.fields['site_ids']
def call(self, auth, person_id_or_email):
# Get account information
if not persons:
raise PLCInvalidArgument, "No such account"
- person = persons.values()[0]
+ person = persons[0]
# Authenticated function
assert self.caller is not None
if not self.caller.can_view(person):
raise PLCPermissionDenied, "Not allowed to view specified account"
- # Filter out deleted sites
- # XXX This shouldn't be necessary once the join tables are cleaned up
- if person['site_ids']:
- sites = Sites(self.api, person['site_ids'])
- return filter(lambda site_id: site_id in sites, person['site_ids'])
-
return person['site_ids']