- added logging variable 'object_type'
[plcapi.git] / PLC / Methods / AdmGetPersonRoles.py
index bfb7c47..e05f955 100644 (file)
@@ -2,10 +2,12 @@ from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Persons import Person, Persons
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
 
 class AdmGetPersonRoles(Method):
     """
+    Deprecated. See GetPersons.
+
     Return the roles that the specified person has as a struct:
 
     {'10': 'admin', '30': 'user', '20': 'pi', '40': 'tech'}
@@ -19,19 +21,19 @@ class AdmGetPersonRoles(Method):
     identifiers.
     """
 
+    status = "deprecated"
+
     roles = ['admin', 'pi', 'user', 'tech']
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         Mixed(Person.fields['person_id'],
               Person.fields['email'])
         ]
 
     returns = dict
 
-    # Stupid return type, and can get now roles through
-    # AdmGetPersons().
-    status = "useless"
+    object_type = 'Person'
 
     def call(self, auth, person_id_or_email):
         # Get account information
@@ -39,7 +41,7 @@ class AdmGetPersonRoles(Method):
         if not persons:
             raise PLCInvalidArgument, "No such account"
 
-        person = persons.values()[0]
+        person = persons[0]
 
         # Authenticated function
         assert self.caller is not None