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

Create ability to do string replacements on base= @Query in interfaces [DATALDAP-22] #43

Closed
spring-projects-issues opened this issue Feb 25, 2017 · 2 comments
Labels
status: duplicate A duplicate of another issue

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Feb 25, 2017

Brett Maxfield opened DATALDAP-22 and commented

It would be nice to be able to replace parameters in base dn of a custom @Query

For example, you can do this as of 1.0.0 (using default SimpleLdapRepository) :

@Query(value="(mail={0})", searchScope=SearchScope.SUBTREE, base="o=hosting,dc=example,dc=com")
MailAccount findByMail(String mail);

The {0} is replaced with the 0'th parameter on the interface, tokens repalced by the spring QueryBuilder

But something you cannot do (so it's a theoretical example, of scope single) :

@Query(value="(mail={0})", searchScope=SearchScope.ONELEVEL, base="jvd={1},o=hosting,dc=example,dc=com")
MailAccount findByDomain(String mail, String domain);

The intent would be to expands the placeholder(s) in the base= field in the annotation, with the numbered argument, and do a search in the requested scope, using the search filter with the replaced parameters. Alternatively (perhaps in addition) using the named @Param annotation, as used by spring-data-jpa

In this case there is a LDAP structure like :

o=hosting
jvd=domain1
mail=somebody@domain1
jvd=domain2
...

The first query is valid, and it works, as it has a subtree scope, and it so happens the mail=* entries under the jvd=domain structure are also unique when queried from o=hosting scope, but it is only a happy accident. In my application i do a findAll() with an LdapQuery incl., a crafted base, this was pushed up to the business objects implementations, a bit messy.

A per-domain search in this application should search in that subtree only. The standard @DnAttribute paradigm is too inflexible for this, as the domain does not stand by itself in any ldap field, that can be mapped to a bean field (without custom logic to split the mail).

If there were (uid=x) entries, which are only valid if searched within the jvd=domain structure, then this would not be appropriate. The (jvd=x) structures are managed by separate organizations, it is a standard structure for virtual mailbox applications


Affects: 1.0 GA (Ingalls)

@spring-projects-issues spring-projects-issues added status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement labels Dec 30, 2020
@CapatanaIonut-rsi
Copy link

Hello,
Any update in this matter ?

Best Regards,
Ionut C

@mp911de mp911de added status: duplicate A duplicate of another issue and removed status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement labels Oct 14, 2024
@mp911de
Copy link
Member

mp911de commented Oct 14, 2024

Closing as duplicate of #453. We will track enhancements in #453 to support variants of parameter bindings.

@mp911de mp911de closed this as completed Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants