1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter
4 from PLC.Roles import Roles
5 from PLC.Auth import PasswordAuth
7 class AdmGetAllRoles(Method):
9 Return all possible roles as a struct:
11 {'10': 'admin', '20': 'pi', '30': 'user', '40': 'tech'}
13 Note that because of XML-RPC marshalling limitations, the keys to
14 this struct are string representations of the integer role
18 roles = ['admin', 'pi', 'user', 'tech']
19 accepts = [PasswordAuth()]
22 def call(self, auth, person_id_or_email_list = None, return_fields = None):
23 roles = Roles(self.api)
25 # Just the role_id: name mappings
26 roles = dict(filter(lambda (role_id, name): isinstance(role_id, (int, long)), \
30 keys = map(str, roles.keys())
32 return dict(zip(keys, roles.values()))