1.2.6 Checking Who Is Signed In

Once we have created the authSsessionManager we can get the username of the current signed in user using authSsessionManager.username(). This method returns an empty string if no user is signed in.

username = authSsessionManager.username()

Usernames are case insensitive but are always stored in the driver as lowercase.

We then need to double check the user exists. We do this using the AuthManager object created in the section on administering the auth environment.

if username and authManager.userExists(username):
    user = authManager.getUser(username)
    print 'Username %s is signed in'%user.username

The object returned by the authManager.getUser() method has the following properties:

class User

Stores read only information about a user. You cannot set the values of the user with this class. Instead you should use the manager object described earlier in the documentation.

username
The username of the user. Usernames are case insensitive but are always stored and returned as lowercase. This means that if you want to compare a username from a database with a value entered by a user, you should first convert the value entered by a user to lowercase like this: username = username.lower()

password
The user's password, 1-255 characters.

firstname
The user's firstname, 1-255 characters. Optional

surname
The user's surname, 1-255 characters. Optional

email
The user's email address, max 255 characters. Optional

level
The access levels for the applications the user has access to as a dictionary with application names as keys.

accessLevel
The access level the user has to the current application.