Find user by login id¶
Find user by login id¶
1# This example finds a user in the active database with a specific login id, comparison is case insensitive
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 login id of the user to find
13user_login_id = "support"
14
15# Find the user, note the Item method will match on index or login id
16user = db.users.item(user_login_id)
17
18# Check the user was found
19if not user.isNone():
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("Login Id: " + str(user.login_id))
26
27else:
28
29 # Display a message in the output toolbox
30 ot.add("Unable to find the user with login id '" + str(user_login_id) + "'")
31