public class ScriptableJndiServices extends ScriptableObject
Simple interface to some methods to access an LDAP directory.
This class is available as "ldap" or "srcLdap" in several JavaScript enabled parameters in the LSC configuration. The methods allow you to interact with an LDAP directory.
Based on Rhino (JavaScript interpreter), this class is able to understand your LQL requests.
All methods in the class use methods from JndiServices
.
Constructor and Description |
---|
ScriptableJndiServices()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
and(Object a,
Object b)
Performs an intersection on two Lists of Strings.
|
List<String> |
attribute(Object base,
Object attrName)
Reads the entry given by a DN, and returns the values of the given attribute.
|
List<String> |
exists(Object dn)
Tests if an entry exists with the given DN.
|
List<String> |
exists(Object dn,
Object filter)
Tests if an entry exists with the given DN and if it matches a given LDAP filter.
|
List<String> |
fsup(Object dn,
Object filter)
Returns a List containing the given DN and all parent DNs that
exist and match a given LDAP filter.
|
String |
getContextDn()
Get the context DN configured for this instance.
|
JndiServices |
getJndiServices() |
List<String> |
list(Object base,
Object filter)
Performs a search with one level scope on a given base DN with a given filter.
|
List<String> |
listAttribute(Object base,
Object filter,
Object attribute)
Performs a search with one level scope on a given base DN with a given
filter returning attribute values
|
List<String> |
or(Object a,
Object b)
Performs a union on two Lists of Strings.
|
List<String> |
read(Object base,
Object filter)
Performs a search with base level scope on a given base DN with a given filter.
|
List<String> |
retain(Object a,
Object b)
Removes all elements of a List of Strings b from a List of Strings a.
|
List<String> |
search(Object base,
Object filter)
Performs a search with subtree scope on a given base DN with a given filter.
|
List<String> |
searchAttribute(Object base,
Object filter,
Object attribute)
Performs a search with subtree scope on a given base DN with a given
filter returning attribute values
|
void |
setJndiServices(JndiServices jndiServices)
Default jndiServices setter.
|
List<String> |
sup(Object dn,
Object level)
Returns the parent DN on the n-th level of a given DN, in a List of Strings.
|
getList, wrap, wrapList, wrapString
public ScriptableJndiServices()
Default constructor.
Default directory properties are based on destination.
public final void setJndiServices(JndiServices jndiServices)
Default jndiServices setter.
jndiServices
- the new valuepublic final JndiServices getJndiServices()
public final List<String> search(Object base, Object filter) throws NamingException
Performs a search with subtree scope on a given base DN with a given filter.
base
- The base DN to search from.filter
- The LDAP filter to use.NamingException
public final List<String> list(Object base, Object filter) throws NamingException
Performs a search with one level scope on a given base DN with a given filter.
base
- The base DN to search from.filter
- The LDAP filter to use.NamingException
public final List<String> searchAttribute(Object base, Object filter, Object attribute) throws NamingException
Performs a search with subtree scope on a given base DN with a given filter returning attribute values
base
- The base DN to search from.filter
- The LDAP filter to use.NamingException
public final List<String> listAttribute(Object base, Object filter, Object attribute) throws NamingException
Performs a search with one level scope on a given base DN with a given filter returning attribute values
base
- The base DN to search from.filter
- The LDAP filter to use.NamingException
public final List<String> read(Object base, Object filter) throws NamingException
Performs a search with base level scope on a given base DN with a given filter.
base
- The base DN to search from.filter
- The LDAP filter to use.NamingException
public final List<String> exists(Object dn, Object filter) throws NamingException
Tests if an entry exists with the given DN and if it matches a given LDAP filter.
dn
- The DN of the entry to check.filter
- The LDAP filter to check on the above DN.NamingException
public final List<String> exists(Object dn) throws NamingException
Tests if an entry exists with the given DN.
dn
- The DN of the entry to check.NamingException
public final List<String> or(Object a, Object b) throws NamingException
Performs a union on two Lists of Strings.
a
- List of Stringsb
- List of StringsNamingException
public final List<String> attribute(Object base, Object attrName) throws NamingException
Reads the entry given by a DN, and returns the values of the given attribute.
base
- The DN of the entry to read.attrName
- The name of the attribute to read.NamingException
public final List<String> and(Object a, Object b) throws NamingException
Performs an intersection on two Lists of Strings.
a
- List of Stringsb
- List of StringsNamingException
public final List<String> retain(Object a, Object b) throws NamingException
Removes all elements of a List of Strings b from a List of Strings a.
a
- List of Stringsb
- List of StringsNamingException
public final List<String> sup(Object dn, Object level) throws NamingException
Returns the parent DN on the n-th level of a given DN, in a List of Strings.
For example, given ("uid=1234,ou=People,dc=normation,dc=com", 2), returns "dc=normation,dc=com" (in a List of Strings).
As a special case, if the requested level is 0, the result is a List of the given DN and all it's parent DNs until the context DN. In the above example, this List would be ["uid=1234,ou=People,dc=normation,dc=com", "ou=People,dc=normation,dc=com", "dc=normation,dc=com"], assuming that the context DN is "dc=normation,dc=com".
This method returns null if a negative level is given.
dn
- The DN whose parent we want.level
- The number of levels to go up, or 0 to return all parent DNs.NamingException
public final List<String> fsup(Object dn, Object filter) throws NamingException
Returns a List containing the given DN and all parent DNs that exist and match a given LDAP filter.
This method returns the same result as sup(dn, 0), with validation that each object exists and matches the given filter.
dn
- The DN whose parents we want.filter
- The LDAP filter to check.NamingException
public String getContextDn()
Get the context DN configured for this instance.
Copyright © 2005-2024 LSC project. All Rights Reserved.