Log PlexPy logins to database

This commit is contained in:
JonnyWong16 2016-05-13 21:43:21 -07:00
parent 27716d080f
commit 8ed7688277
8 changed files with 1018 additions and 7 deletions

View file

@ -1165,6 +1165,27 @@ class WebInterface(object):
return history
@cherrypy.expose
@cherrypy.tools.json_out()
@requireAuth()
def get_user_logins(self, user_id=None, **kwargs):
""" Get the data on PlexPy user login table. """
# Check if datatables json_data was received.
# If not, then build the minimal amount of json data for a query
if not kwargs.get('json_data'):
# TODO: Find some one way to automatically get the columns
dt_columns = [("time", True, False),
("ip_address", True, True),
("host", True, True),
("os", True, True),
("browser", True, True)]
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "time")
user_data = users.Users()
history = user_data.get_datatables_user_login(user_id=user_id, kwargs=kwargs)
return history
@cherrypy.expose
@cherrypy.tools.json_out()
@requireAuth(member_of("admin"))