add a note in GetPersons about a possible privacy leak
[plcapi.git] / PLC / Methods / GetPersonTags.py
1 #
2 # Thierry Parmentelat - INRIA
3 #
4 from PLC.Faults import *
5 from PLC.Method import Method
6 from PLC.Parameter import Parameter, Mixed
7 from PLC.Filter import Filter
8 from PLC.Auth import Auth
9
10 from PLC.PersonTags import PersonTag, PersonTags
11
12 class GetPersonTags(Method):
13     """
14     Returns an array of structs containing details about
15     persons and related settings.
16
17     If person_tag_filter is specified and is an array of
18     person setting identifiers, only person settings matching
19     the filter will be returned. If return_fields is specified, only
20     the specified details will be returned.
21     """
22
23     roles = ['admin', 'pi', 'user', 'node']
24
25     accepts = [
26         Auth(),
27         Mixed([PersonTag.fields['person_tag_id']],
28               Parameter(int,"Person setting id"),
29               Filter(PersonTag.fields)),
30         Parameter([str], "List of fields to return", nullok = True)
31         ]
32
33     returns = [PersonTag.fields]
34
35
36     def call(self, auth, person_tag_filter = None, return_fields = None):
37
38         person_tags = PersonTags(self.api, person_tag_filter, return_fields)
39
40         return person_tags