omero.util.sessions module¶
Library for managing user sessions.
- class util.sessions.SessionsStore(dir=None)[source]¶
Bases:
object
The store is a file-based repository of user sessions. By default, stores use $HOME/omero/sessions as their repository path.
Use add() to add items to the repository
- add(host, name, id, props, sudo=None)[source]¶
Stores a file containing the properties at REPO/host/name/id
- attach(server, name, sess, set_current=True)[source]¶
Simple helper. Delegates to create() using the session as both the username and the password. This reproduces the logic of client.joinSession()
- available(host, name)[source]¶
Returns the path to property files which are stored. Internal accounting files are not returned.
- clear(host=None, name=None, sess=None)[source]¶
Walks through all sessions and calls killSession. Regardless of exceptions, it will remove the session files from the store.
- conflicts(host, name, id, new_props, ignore_nulls=False, check_group=True)[source]¶
Compares if the passed properties are compatible with with those for the host, name, id tuple
If ignore_nulls is True, then a null in new_props means matches anything.
- contents()[source]¶
Returns a map of maps with all the contents of the store. Internal accounting files are skipped.
- create(name, pasw, props, new=True, set_current=True, sudo=None)[source]¶
Creates a new omero.client object, and returns: (cilent, session_id, timeToIdle, timeToLive)
- find_name_by_key(server, uuid)[source]¶
Returns the name of a user for which the session key exists. This value is taken from the path rather than from the properties file since that value may have been overwritten. An exception is raised if there is more than one name since keys should be UUIDs. A None may be returned.
- non_dot(d)[source]¶
Only returns the files (not directories) contained in d that don’t start with a dot
- remove(host, name, uuid)[source]¶
Removes the given session file from the store and removes the sess_file() if it is equal to the session we just removed.