Skip to content

Commit

Permalink
lsc-project#176: Readded sortedBy controls for ldap context.
Browse files Browse the repository at this point in the history
  • Loading branch information
abpai94 committed Sep 2, 2024
1 parent e0a7266 commit ff9a586
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/org/lsc/jndi/JndiServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void initConnection()
throw new NamingException(e.getMessage());
}

// Setting global pageSize variable for LDAPContext
// Setting global pageSize variable
String pageSizeStr = (String) ctx.getEnvironment().get("java.naming.ldap.pageSize");
if (pageSizeStr != null && Integer.parseInt(pageSizeStr) > -1) {
pageSize = Integer.parseInt(pageSizeStr);
Expand All @@ -246,8 +246,14 @@ private void initConnection()
ctx.setRequestControls(requestControls.toArray(new Control[requestControls.size()]));
}

// Setting global sortedBy variable
sortedBy = (String) ctx.getEnvironment().get("java.naming.ldap.sortedBy");

if (sortedBy != null) {
List<SortControl> requestControls = new ArrayList<>();
requestControls.add(new SortControl(sortedBy, Control.CRITICAL));
ctx.setRequestControls(requestControls.toArray(new Control[requestControls.size()]));
}

String recursiveDeleteStr = (String) ctx.getEnvironment().get("java.naming.recursivedelete");
if (recursiveDeleteStr != null) {
recursiveDelete = Boolean.parseBoolean(recursiveDeleteStr);
Expand Down

0 comments on commit ff9a586

Please sign in to comment.