Skip to content

Commit

Permalink
Merge pull request #7 from nextcloud/fix/4/fix-unset-userbase
Browse files Browse the repository at this point in the history
fallback to the general base if user or group base was not set. Fixes #4
  • Loading branch information
blizzz authored Jun 28, 2019
2 parents 34e8d0e + 87123ed commit 16c01b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/LDAPConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,19 @@ public function getLDAPConnection() {
}

public function getLDAPBaseUsers() {
return $this->ldapConfig->ldapBaseUsers;
$bases = $this->ldapConfig->ldapBaseUsers;
if(empty($bases)) {
$bases = $this->ldapConfig->ldapBase;
}
return $bases;
}

public function getLDAPBaseGroups() {
return $this->ldapConfig->ldapBaseGroups;
$bases = $this->ldapConfig->ldapBaseGroups;
if(empty($bases)) {
$bases = $this->ldapConfig->ldapBase;
}
return $bases;
}

public function getDisplayNameAttribute() {
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ Feature: user
And the HTTP status code should be "200"
And the created users resides on LDAP

# requires NC 17
Scenario: create a new user with dynamic user id without user base set
Given As an "admin"
And parameter "newUser.generateUserID" of app "core" is set to "yes"
And modify LDAP configuration
| ldapBaseUsers | |
When creating a user with
| userid | |
| password | 123456 |
Then the OCS status code should be "200"
And the HTTP status code should be "200"
And the created users resides on LDAP

# requires NC 17
Scenario: create a new user with dynamic user id
Given As an "admin"
Expand Down

0 comments on commit 16c01b1

Please sign in to comment.