Skip to content

Commit

Permalink
Merge branch 'rm1759' into 'master'
Browse files Browse the repository at this point in the history
rm1759: fix group synchronization

See merge request shared/runawfe-professional-server!131
  • Loading branch information
dofs197 committed Aug 2, 2020
2 parents 0f9c54b + c7f8d51 commit 24bc0ed
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions wfe-core/src/main/java/ru/runa/wfe/security/logic/LdapLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,30 @@ private int synchronizeGroups(DirContext dirContext, Map<String, Actor> actorsBy
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
Map<String, SearchResult> groupResultsByDistinguishedName = Maps.newHashMap();
for (String ou : LdapProperties.getSynchronizationOrganizationUnits()) {
NamingEnumeration<SearchResult> list = dirContext.search(ou, OBJECT_CLASS_GROUP_FILTER, controls);
while (list.hasMore()) {
SearchResult searchResult = list.next();
if (searchResult.getAttributes().get(ATTR_GROUP_MEMBER) == null) {
continue;
try {
NamingEnumeration<SearchResult> list = dirContext.search(ou, OBJECT_CLASS_GROUP_FILTER, controls);
while (list.hasMore()) {
SearchResult searchResult = list.next();
if (searchResult.getAttributes().get(ATTR_GROUP_MEMBER) == null) {
continue;
}
groupResultsByDistinguishedName.put(searchResult.getNameInNamespace(), searchResult);
}
list.close();
} catch (SizeLimitExceededException e) {
for (String y : ALPHABETS) {
NamingEnumeration<SearchResult> list = dirContext.search(ou,
MessageFormat.format(LOGIN_FIRST_LETTER_FILTER, ATTR_GROUP_NAME, y, y.toLowerCase(), OBJECT_CLASS_GROUP_FILTER),
controls);
while (list.hasMore()) {
SearchResult searchResult = list.next();
if (searchResult.getAttributes().get(ATTR_GROUP_MEMBER) == null) {
continue;
}
groupResultsByDistinguishedName.put(searchResult.getNameInNamespace(), searchResult);
}
list.close();
}
groupResultsByDistinguishedName.put(searchResult.getNameInNamespace(), searchResult);
}
}
for (SearchResult searchResult : groupResultsByDistinguishedName.values()) {
Expand Down

0 comments on commit 24bc0ed

Please sign in to comment.