Find user by key

Find user by key
 1# This example finds a user in the active database with a specific key
 2
 3# Create a local variable for the output toolbox
 4ot = impact.gui.output_toolbox
 5
 6# Clear the output toolbox
 7ot.clear()
 8
 9# Create a local variable for the active database
10db = impact.active_database
11
12# Create a local variable for the key of the user to find
13user_key = 1
14
15# Find the user
16user = db.users.find_by_key(user_key)
17
18# Check the user was found
19if user is not None:
20
21    # Display a message in the output toolbox
22    ot.add("Found the user")
23
24    # Display the full name of the user in the output toolbox
25    ot.add("Full name: " + str(user.full_name))
26
27else:
28
29    # Display a message in the output toolbox
30    ot.add("Unable to find the user with key '" + str(user_key) + "'")