mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-22 06:13:25 -07:00
Use custom_where to filter users
This commit is contained in:
parent
0036c35c11
commit
33a36ec132
2 changed files with 8 additions and 8 deletions
|
@ -21,7 +21,7 @@ class Users(object):
|
|||
def __init__(self):
|
||||
pass
|
||||
|
||||
def get_user_list(self, filtered_users=False, kwargs=None):
|
||||
def get_user_list(self, kwargs=None, custom_where=None):
|
||||
data_tables = datatables.DataTables()
|
||||
|
||||
columns = ['session_history.id',
|
||||
|
@ -48,7 +48,7 @@ class Users(object):
|
|||
try:
|
||||
query = data_tables.ssp_query(table_name='users',
|
||||
columns=columns,
|
||||
custom_where=[],
|
||||
custom_where=custom_where,
|
||||
group_by=['users.user_id'],
|
||||
join_types=['LEFT OUTER JOIN',
|
||||
'LEFT OUTER JOIN',
|
||||
|
@ -72,9 +72,6 @@ class Users(object):
|
|||
|
||||
rows = []
|
||||
for item in users:
|
||||
if filtered_users and item["show_user"] == 0:
|
||||
continue
|
||||
|
||||
if item["media_type"] == 'episode' and item["parent_thumb"]:
|
||||
thumb = item["parent_thumb"]
|
||||
elif item["media_type"] == 'episode':
|
||||
|
|
|
@ -255,11 +255,14 @@ class WebInterface(object):
|
|||
return serve_template(templatename="ip_address_modal.html", title="IP Address Details", data=ip_address)
|
||||
|
||||
@cherrypy.expose
|
||||
def get_user_list(self, filtered_users=False, **kwargs):
|
||||
filtered_users = filtered_users == 'true'
|
||||
def get_user_list(self, filtered_users=None, **kwargs):
|
||||
|
||||
custom_where=[]
|
||||
if filtered_users == 'true':
|
||||
custom_where = [['show_user', 1]]
|
||||
|
||||
user_data = users.Users()
|
||||
user_list = user_data.get_user_list(filtered_users=filtered_users, kwargs=kwargs)
|
||||
user_list = user_data.get_user_list(kwargs=kwargs, custom_where=custom_where)
|
||||
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
return json.dumps(user_list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue