Working on User Information¶
Note
Please note that this is not a full command list, if you’re missing commands, feel free to ask over at the Community.
Find User¶
In order to work on user information or to check for specific information, you’ll need to find it first.
Search by user ID:
>> User.find(4)
Searching for the user by email address:
>> User.find_by(email: 'your@email')
Searching for the user by login:
>> User.find_by(login: 'john.doe')
Unlock a Locked User Account¶
Tip
Unlocking a locked user account is also supported by Zammad’s web UI. Please refer to the admin documentation for more information.
It sometimes happens that a user locks himself out by wildly trying the wrong password multiple times. Depending on your maximum failing login count (default: 10 times), Zammad might lock the account.
The user can’t login anymore (forever) if he doesn’t change the password or you reset the counter.
Write user ID to u:
>> u=User.find(**USERID**)
Reset failed login counter:
>> u.login_failed=0
Save the changes:
>> u.save!
You can also double check if the account is locked by running the following command (result needs to be 1 above your limit, so 11 for the default of 10 failing logins):
>> User.find(**USERID**).login_failed
Change / Update Email Address of User¶
If needed, you can simply change the Email address of the user.
Note
Please note that the login attribute is not affected by this and Zammad thus might show different information within the UI.
Write user ID to u:
>> u = User.find(**USERID**)
Change email address of user:
>> u.email = 'user@exmaple.com'
Save it:
>> u.save!
Change / Update Login Name of User¶
Change the user name of the user (e.g. if you want to login with a shorter username instead of a mail address)
Write user ID to u:
>> u = User.find(**USERID**)
Change user’s login:
>> u.login = 'user@exmaple.com'
Save changes:
>> u.save!
Set Admin Rights for User¶
Don’t have access to Zammad anymore? Grant yourself or another user administrative rights.
Write user ID to u:
>> u = User.find_by(email: 'you@example.com')
Assign roles to the user:
>> u.roles = Role.where(name: ['Agent', 'Admin'])
Save changes:
>> u.save!
Set Password for User¶
You or the user did forget his password? No problem! Simply reset it by hand if needed.
>> User.find_by(email: 'you@example.com').update!(password: 'your_new_password')