Add 'php/phpxmlrpc/' from commit 'cd5dbb4a511e7a616a61187a5de1a611a9748cbd'
[plcapi.git] / PLC / Methods / GetSessions.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Filter import Filter
5 from PLC.Sessions import Session, Sessions
6 from PLC.Persons import Person, Persons
7 from PLC.Auth import Auth
8
9 class GetSessions(Method):
10     """
11     Returns an array of structs containing details about users sessions. If
12     session_filter is specified and is an array of user identifiers or
13     session_keys, or a struct of session attributes, only sessions matching the
14     filter will be returned. If return_fields is specified, only the
15     specified details will be returned.
16
17
18     """
19
20     roles = ['admin']
21
22     accepts = [
23         Auth(),
24         Mixed([Mixed(Session.fields['person_id'],
25                      Session.fields['session_id'])],
26               Filter(Session.fields))
27         ]
28
29     returns = [Session.fields]
30
31     def call(self, auth, session_filter = None):
32
33         sessions = Sessions(self.api, session_filter)
34
35         return sessions