spring-projects / spring-projects/spring-ldap
ODM for a group with lot of members are not fetched correctly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 375
- Forks
- 501
- Avg merge
- 6h 4m
- Merged PRs (30d)
- 63
Description
Hi
I have Group ODM class as below:
`
@Entry(objectClasses = { "group", "top" }, base = "OU=group")
public final class ADGroup implements Serializable {
private static final long serialVersionUID = 915331212576640803L;
@Id
private Name dn;
@Attribute(name = "cn")
@DnAttribute(value="cn", index=1)
private String name;
@Attribute(name = "member")
private Set<Name> members;
public Name getDn() {
return dn;
}
public void setDn(Name dn) {
this.dn = dn;
}
public Set<Name> getMembers() {
return members;
}
public void setMembers(Set<Name> members) {
this.members = members;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void addMember(Name member) {
members.add(member);
}
public void removeMember(Name member) {
members.remove(member);
}
}`
When I get this ODM class using the ldapTempalte as below
`
ADGroup adGuest = aDldapTemplate.findOne(query().where("cn").is("MyGroup"), ADGroup.class);
Set members = adGuest.getMembers();
log.info("members.size()="+members.size());
`
I see the ODM class mapped to AD group correctly and when I turn on log to trace level I do see member accounts which comes in as
{member;range=0-1499[0]=CN=abc1....,member;range=0-1499[1]=CN=abc2 ....until, member;range=0-1499[1499]=CN=abc1499
I understand this due to set count limit set on Active Directory that only allows certain count of members. And when this happens, "member" attribute is not correctly mapped and "adGuest.getMembers();" does not show the correct count of (1500 ) but just shows 0.
I do not want to change AD bind setting to get all the data at once because it could be huge, but I do want to be able to run pageable like option to get all the records. When I tested this with group with smaller number of members (,1500), it worked just fine, giving the right count and member info as well.
So question is;
Is there a way make this pageable like query and fetch all the records ? If so how to do this. Is there some annotation that I need to provide in ODM class itself or is that done in aDldapTemplate.findOne like call. It will be great to get some insight on this with code snippet to do this.
Thank you in advance
Su
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the ADGroup ODM class and the ldapTemplate.findOne call, using a group whose member attribute is returned with member;range values. Compare the mapped member count with the LDAP trace output, then verify that the completed behavior retrieves all ranged members without requiring an unlimited AD bind setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100