Verified and updated manual testing instructions

This commit is contained in:
ViViDboarder 2019-10-02 14:28:54 -07:00
parent e962a4bbca
commit 510bed68aa
3 changed files with 38 additions and 2 deletions

View File

@ -31,6 +31,35 @@ Configuration values are as follows:
|`ldap_sync_interval_seconds`|Integer|Optional|Number of seconds to wait between each LDAP request. Defaults to `60`|
|`ldap_sync_loop`|Boolean|Optional|Indicates whether or not syncing should be polled in a loop or done once. Defaults to `true`|
## Testing
All testing is manual right now. First step is to set up Bitwarden and the LDAP server.
```bash
docker-compose up -d bitwarden ldap ldap_admin
```
1. After that, open the admin portal on http://localhost:8001 and log in using the default account info:
Username: cn=admin,dc=example,dc=org
Password: admin
From there you can set up your test group and users.
2. Expand the `dc=example,dc=org` nav tree and select "Create new entry here"
3. Select "Generic: Posix Group"
4. Give it a name, eg. "Users" and then save and commit
5. Select "Create child object"
6. Select "Generic: User Account"
7. Give the user a name and select a group ID number and save and commit
8. Select "Add new attribute" and select "Email" and then add a test email address
9. Run the ldap sync
```bash
docker-compose up ldap_sync
```
## Future
* Any kind of proper logging

View File

@ -6,7 +6,8 @@ services:
# dockerfile: Dockerfile.alpine
volumes:
- ./example.config.toml:/usr/src/bitwarden_rs_ldap/config.toml:ro
# - ./example.config.toml:/config.toml:ro
environment:
RUST_BACKTRACE: 1
restart: always
bitwarden:

View File

@ -115,7 +115,11 @@ fn invite_from_ldap(
let mut num_users = 0;
for ldap_user in search_entries(config)? {
// Safely get first email from list of emails in field
if let Some(user_email) = ldap_user.attrs.get(mail_field.as_str()).and_then(|l| (l.first())) {
if let Some(user_email) = ldap_user
.attrs
.get(mail_field.as_str())
.and_then(|l| (l.first()))
{
if existing_users.contains(user_email) {
println!("User with email already exists: {}", user_email);
} else {
@ -125,6 +129,8 @@ fn invite_from_ldap(
num_users = num_users + 1;
// println!("Invite response: {:?}", response);
}
} else {
println!("Warning: Email field, {:?}, not found on user", mail_field);
}
}