Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="DirectoryUtil") public interface DirectoryUtil
An instance of the Sitevision class implementing this interface can be obtained via Utils.getDirectoryUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Modifier and Type | Method and Description |
---|---|
Property |
getAttributeAsProperty(Node aDirectoryObjectNode,
String anAttributeName)
Gets a directory attribute value for a directory node object as
Property . |
Node |
getNodeByDN(String aDirectoryObjectDN)
Gets a directory node object with a specific distinguished name, dn.
|
List<Node> |
search(String aSearchFilter)
Searches for objects in all LDAP directories that are accessible in current context (i.e. current page).
|
List<Node> |
search(String aSearchFilter,
Node aDirectoryNode)
Searches for objects in a specified LDAP directory.
|
List<Node> |
search(String aSearchFilter,
Node aDirectoryNode,
String aSearchBase)
Searches for objects in a specified search base in a specified LDAP directory.
|
Map<String,Map<String,String>> |
simpleSearch(String aSearchFilter,
String searchBase,
List<String> attributes)
Searches for ids in a specified search base in all directories.
|
List<Node> search(String aSearchFilter)
Some examples of RFC 2254 valid values for aSearchFilter
:
"magnus"
- find all magnus, using the search base specified by the directories (usually common name) "(cn=magnus)"
- find all with common name (cn) magnus"(cn=magnus*)"
- find all that has a common name (cn) that starts with magnus"(&(cn=magnus)(mail=*))"
- find all that has a mail address and magnus as common name (cn)"(|(cn=magnus)((sn=L*)))"
- find all with common name (cn) magnus or a surname (sn) that starts with LaSearchFilter
- LDAP search filter (as specified by RFC 2254)List
. If there are no hits, an empty List
is returned.search(String,Node)
List<Node> search(String aSearchFilter, Node aDirectoryNode)
Tip! The repository for all LDAP directory nodes can be located via the
getDirectoryRepository()
method in ResourceLocatorUtil
aSearchFilter
- LDAP search filter (as specified by RFC 2254)aDirectoryNode
- a LDAP directory Node
List
. If there are no hits, an empty List
is returned.search(String)
List<Node> search(String aSearchFilter, Node aDirectoryNode, String aSearchBase)
aSearchFilter
- LDAP search filter (as specified by RFC 2254)aDirectoryNode
- a LDAP directory Node
aSearchBase
- a search base that exist in aDirectoryNode
List
. If there are no hits, an empty List
is returned.search(String,Node)
Node getNodeByDN(String aDirectoryObjectDN)
aDirectoryObjectDN
- the directory dn for a directory objectNode
, or null if indeterminateProperty getAttributeAsProperty(Node aDirectoryObjectNode, String anAttributeName)
Property
.
The default properties for a directory node object adheres/corresponds to the attributes defined in the directory scheme. All attributes that are defined in the scheme are exposed as properties in the Sitevision JCR model. This method tries to find the attribute via the Sitevision JCR model but if no property can be found it executes LDAP queries to find the attribute. This makes it possible to find scheme-defined attributes, but also custom-defined ones.
aDirectoryObjectNode
- a directory object node that has an attributeanAttributeName
- the attribute nameProperty
, or null
if indeterminate
(e.g. aDirectoryObjectNode
is not a directory object node
or aDirectoryObjectNode
has no attribute named anAttributeName
)Map<String,Map<String,String>> simpleSearch(String aSearchFilter, String searchBase, List<String> attributes)
aSearchFilter
- LDAP search filter (as specified by RFC 2254)searchBase
- search base for the search, if null
all directories for current node will be searchedattributes
- a List
of return attributesMap
. If there are no hits, an empty Map
is returned.
The Map
contains ids as keys and a Map
as values containing the returned attributes.Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.