Skip to content

Commit

Permalink
Closes #436 - fix mistakenly required ldap-permission-props to be opt…
Browse files Browse the repository at this point in the history
…ional
  • Loading branch information
bruderj15 authored Feb 6, 2025
1 parent 29013b2 commit dcc80e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,11 @@ List<LdapSettings> checkForMissingConfigurations() {
.filter(not(LdapSettings.KADAI_LDAP_PERMISSIONS_OF_USER_NAME::equals))
.filter(not(LdapSettings.KADAI_LDAP_PERMISSIONS_OF_USER_TYPE::equals))
.filter(not(LdapSettings.KADAI_LDAP_PERMISSION_ID_ATTRIBUTE::equals))
.filter(not(LdapSettings.KADAI_LDAP_PERMISSION_SEARCH_BASE::equals))
.filter(not(LdapSettings.KADAI_LDAP_PERMISSION_SEARCH_FILTER_NAME::equals))
.filter(not(LdapSettings.KADAI_LDAP_PERMISSION_SEARCH_FILTER_VALUE::equals))
.filter(not(LdapSettings.KADAI_LDAP_PERMISSION_NAME_ATTRIBUTE::equals))
.filter(not(LdapSettings.KADAI_LDAP_USER_PERMISSIONS_ATTRIBUTE::equals))
.filter(not(LdapSettings.KADAI_LDAP_GROUP_ID_ATTRIBUTE::equals))
.filter(p -> p.getValueFromEnv(env) == null)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.core.env.Environment;

/**
* Required settings to run ldap.
* All possible settings for LDAP.
*/
enum LdapSettings {
KADAI_LDAP_USER_SEARCH_BASE("kadai.ldap.userSearchBase"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,9 @@ void testLdap_isInitorFail() {

@Test
void testLdap_checkForMissingConfigurations() {
// 17 optional config fields: minSearchForLength, maxNumberOfReturnedAccessIds,
// userPhoneAttribute, userMobilePhoneAttribute, userEmailAttribute, userOrglevel1Attribute,
// userOrglevel2Attribute, userOrglevel3Attribute, userOrglevel4Attribute, groupsOfUser,
// groupsOfUserName, groupOfUserType, groupIdAttribute, permissionIdAttribute,
// permissionsOfUser, permissionsOfUserType, permissionsOfUserName
assertThat(cut.checkForMissingConfigurations()).hasSize(LdapSettings.values().length - 17);
final int optionalCount = 22;
assertThat(cut.checkForMissingConfigurations())
.hasSize(LdapSettings.values().length - optionalCount);
}

@Test
Expand Down

0 comments on commit dcc80e6

Please sign in to comment.