User Session Commands
This page includes the following:
disconnect_session()
Disconnect the session with the given user and login time. In the unlikely event that more than one such session exists, one will be arbitrarily chosen.
Parameters:
-
user- name of the user as obtained from user_sessions() -
login_time- start time of the session as obtained from user_sessions()For more information, see User Session Commands.
Dependencies:
-
Must be logged in as admin
Result:
-
The specified user is disconnected from system, logged out.
Example disconnect_session() command line usage:
>>> disconnect_session(user=user_sessions()[0].user(),
login_time=user_sessions()[0].login_time())
Example disconnect_session() script usage:
import sys
from jaws import *
login()
print 'begin'
try:
sess = user_sessions()
for s in sess:
print 'user' + s.user() + ', ' + s.login_time()
disconnect_session(user=s.user(), login_time=s.login_time())
print s.user() + ' disconnected'
print 'end'
finally:
logout()
user_sessions()
Get a list of active sessions for all users.
Parameters:
- None
Dependencies:
-
Must be logged in
Result:
-
A list of UserSessionWrapper objects, see UserSessionWrapper.
Example user_sessions() command line usage:
>>> user_sessions()
[<__main__.UserSessionWrapper instance at 0x8>,
<__main__.UserSessionWrapper instance at 0x9>,
<__main__.UserSessionWrapper instance at 0xa>,
<__main__.UserSessionWrapper instance at 0xb>,
<__main__.UserSessionWrapper instance at 0xc>]
Example user_sessions() script usage:
import sys
from jaws import *
login()
print 'begin output'
try:
usr = user_sessions()
for u in usr:
print u
print ' user: ' + u.user()
print ' login time: ' + u.login_time()
print ' is admin: ' + str(u.is_user_admin())
print ' client type: ' + u.client_type()
print ' client host: ' + u.client_host()
print ' app ID: ' + u.application_id()
print 'end output'
finally:
logout()