Add PersonTags as well. Performed a simple test but not extensive regression
[plcapi.git] / PLC / Methods / GetPersonTags.py
1 # $Id: GetPersonTags.py 14587 2009-07-19 13:18:50Z thierry $
2 # $URL: http://svn.planet-lab.org/svn/PLCAPI/tags/PLCAPI-4.3-27/PLC/Methods/GetPersonTags.py $
3 #
4 # Thierry Parmentelat - INRIA
5 #
6 # $Revision: 14587 $
7 #
8 from PLC.Faults import *
9 from PLC.Method import Method
10 from PLC.Parameter import Parameter, Mixed
11 from PLC.Filter import Filter
12 from PLC.Auth import Auth
13
14 from PLC.PersonTags import PersonTag, PersonTags
15
16 class GetPersonTags(Method):
17     """
18     Returns an array of structs containing details about
19     persons and related settings.
20
21     If person_tag_filter is specified and is an array of
22     person setting identifiers, only person settings matching
23     the filter will be returned. If return_fields is specified, only
24     the specified details will be returned.
25     """
26
27     roles = ['admin', 'pi', 'user', 'node']
28
29     accepts = [
30         Auth(),
31         Mixed([PersonTag.fields['person_tag_id']],
32               Parameter(int,"Person setting id"),
33               Filter(PersonTag.fields)),
34         Parameter([str], "List of fields to return", nullok = True)
35         ]
36
37     returns = [PersonTag.fields]
38     
39
40     def call(self, auth, person_tag_filter = None, return_fields = None):
41
42         person_tags = PersonTags(self.api, person_tag_filter, return_fields)
43
44         return person_tags