Announcement Announcement Module
Collapse
No announcement yet.
ldaptemplate search using timestamp Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ldaptemplate search using timestamp

    I was trying to write a ldaptemplate search that would return all uid's that have been a member of a role for a number of days. Ex: Return all users that have been a member of role 'inactive' for '30' days.

    I have the role part working but I'm not sure how to check the timestamp attribute that contains the number days in role and see if they've been in it for 30 days.

    expiredTime = currentdate + 30 days.

    List<String> list = ldapTemplate.search("",
    "(&(objectClass=person)" +
    "(&(member=cn=inactive,ou=roles,dc=h,dc=com)" +
    "(RoleChangedTime>"+expiredTime+")))",
    new AbstractContextMapper() {
    protected Object
    doMapFromContext(DirContextOperations ctx) {
    return ctx.getStringAttribute("uid");
    }
    });

    Can this be done in an 'ldaptemplate.search' without first returning the 'RoleChangedTime', adding 30 days to this timestamp value and then comparing it to the current date?

    Thanks,
    Dave
Working...
X