because i need sometimes from my omero web app see who is online from my users, so i added the following function in webadmin/views.py
and i added the required html files
- Code: Select all
@login_required(isAdmin=True)
@render_response_admin()
def experimenters_online(request, conn=None, **kwargs):
template = "webadmin/experimenters_online.html"
client = omero.client("localhost")
conn.getSession()
session = client.createSession("root", "XXXXXXXXXXXXX")
req = omero.cmd.CurrentSessionsRequest()
try:
cb = client.submit(req)
try:
rsp = cb.getResponse()
finally:
cb.close(True)
finally:
myList = list(rsp.contexts)
context = {'experimenterListonline': myList }
context['template'] = template
return context
this code is works for me and i can see the current sessions in my omero app,
NOW my qustion i want to optimized this by not inserting user and password in the code
i mean this line
- Code: Select all
session = client.createSession("root", "XXXXXXXXXXXXX")
how i can update the last function to not giving the username and pass
regards
Saleh