Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/groovy/gldapo/GldapoDirectory.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class GldapoDirectory implements SearchProvider {
ContextMapper mapper = new GldapoContextMapper(schemaRegistration: schemaRegistration, directory: this)
ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler(mapper)

javax.naming.directory.SearchControls jndiControls = controls as javax.naming.directory.SearchControls
javax.naming.directory.SearchControls jndiControls = controls.asJavaxSearchControls()
jndiControls.returningAttributes = schemaRegistration.attributeMappings*.value.attributeName

if (controls.pageSize == null || controls.pageSize < 1) {
Expand Down
18 changes: 11 additions & 7 deletions src/main/groovy/gldapo/search/SearchControls.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,20 @@ class SearchControls implements SearchControlProvider, Cloneable {
def asType(Class c)
{
if (c.equals(javax.naming.directory.SearchControls)) {
def controls = new javax.naming.directory.SearchControls()
if (this.countLimit != null) controls.countLimit = this.countLimit
if (this.derefLinkFlag != null) controls.derefLinkFlag = this.derefLinkFlag
if (this.searchScope != null) controls.searchScope = this.searchScopeAsInteger
if (this.timeLimit != null) controls.timeLimit = this.timeLimit
controls.returningObjFlag = true
return controls
return asJavaxSearchControls()
}
else {
super(c)
}
}

def asJavaxSearchControls() {
def controls = new javax.naming.directory.SearchControls()
if (this.countLimit != null) controls.countLimit = this.countLimit
if (this.derefLinkFlag != null) controls.derefLinkFlag = this.derefLinkFlag
if (this.searchScope != null) controls.searchScope = this.searchScopeAsInteger
if (this.timeLimit != null) controls.timeLimit = this.timeLimit
controls.returningObjFlag = true
controls
}
}