Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search object by attribute with less or greater than #82

Open
schneidr opened this issue Jul 24, 2024 · 1 comment
Open

Search object by attribute with less or greater than #82

schneidr opened this issue Jul 24, 2024 · 1 comment

Comments

@schneidr
Copy link

Is there any way to search for objects by attributes and using <= or >= as search operators?

For example, I want to search for all user accounts that have been created within the last seven days. With a regular LDAP query I can do this:

    start_time = datetime.today()  - timedelta(days = 7)
    result = self.search(
        "(&(objectClass=user)(whenCreated>={}))".format(start_time.strftime("%Y%m%d%H%M%S.0Z")),
        ["cn", "displayName", "mail", "o", "whenCreated"]
    )

With this library I only see the option to search with the = operator. Is there any way to to this with ms_active_directory?

@ndelo
Copy link

ndelo commented Nov 22, 2024

Agreed. It would be nice in general to be able to pass an ldap filter string in a search. I was also looking to filter by the whenCreated attribute in the same way as @schneidr

If this can already be done, it would be nice to see this reflected in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants