Search Active Directory users¶
FindUsers lets a caller locate one or more EXTERNAL-domain accounts by user ID, ID number, name, and an optional test-user flag, without needing to construct an LDAP filter directly. The method assembles the filter string and delegates the actual directory search to clsDirectoryServer.
| Field | Value |
|---|---|
| Operation ID | OP-SU-02 |
| Trigger | Caller calls clsSystemUser.FindUsers(inUserID, inIDNumber, inName, [inTestUserIDFlag], [inDomain]) |
| Inputs | inUserID, inIDNumber, inName search criteria; optional inTestUserIDFlag ("Y"/"N"); optional inDomain (defaults to "EXTERNAL", accepted but not used to alter the query) |
| Outputs | clsUserCollection of AD entries matching the assembled filter; also cached on m_DirUserCol |
| Primary components | clsSystemUser.FindUsers(...), clsSystemUser.BuildLDAPQuery(...) |
| Entry point | Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb |
Steps¶
- Build the LDAP filter (
BuildLDAPQuery). Starting from an empty string, the method appends filter clauses only for criteria that were actually supplied: - If
inIDNumberis non-empty: append(Info=<inIDNumber>). - If
inUserIDis non-empty and not"*": append(CN=<inUserID>). - If
inNameis non-empty and not"*": append(Company=<inName>). - If
inTestUserIDFlagis"Y"/"y": append(description=Y)to restrict results to test users. - If
inTestUserIDFlagis"N"/"n": append(!(description=Y))to exclude test users. - Otherwise (any other value, including the default empty string): no test-user clause is appended, and results are not filtered by the flag.
- Note the unused domain parameter.
inDomainis accepted by bothFindUsersandBuildLDAPQuerybut is never read inside either method body — the search always executes against whatever directory contextm_DirServerwas bound to during construction, not a domain selected at search time.* - Execute the search.
FindUserspasses the assembled filter string tom_DirServer.FindUsers(ldapQuery). - Cache and return the results. The resulting
clsUserCollectionis stored onm_DirUserCol(also exposed via theUserCollectionread-only property) and returned to the caller.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller calls FindUsers]) --> Build[Build LDAP filter from supplied criteria]
Build --> IDNum{IDNumber supplied?}
IDNum -->|Yes| AddInfo[Append Info clause]
IDNum -->|No| UserID
AddInfo --> UserID{UserID supplied and not '*'?}
UserID -->|Yes| AddCN[Append CN clause]
UserID -->|No| Name
AddCN --> Name{Name supplied and not '*'?}
Name -->|Yes| AddCompany[Append Company clause]
Name -->|No| TestFlag
AddCompany --> TestFlag{Test-user flag value?}
TestFlag -->|Y| AddDescY[Append description=Y clause]
TestFlag -->|N| AddDescN[Append negated description=Y clause]
TestFlag -->|other/empty| Search[Execute m_DirServer.FindUsers]
AddDescY --> Search
AddDescN --> Search
Search --> Cache[Cache result on m_DirUserCol]
Cache --> Return([Return clsUserCollection])
Failure and edge-case behavior¶
- Supplying no criteria at all produces an empty filter string, so the resulting search behavior depends entirely on how
clsDirectoryServer.FindUsersinterprets an empty query.** - The
inDomainparameter is dead in bothFindUsersandBuildLDAPQuery— passing a value other than"EXTERNAL"has no observable effect on the query or the directory context searched.* - A wildcard (
"*") forinUserIDorinNameis treated the same as an empty value: the corresponding clause is omitted rather than translated into an LDAP wildcard filter. - Test-user filtering only recognizes
"Y"/"y"and"N"/"n"; any other value (including whitespace) silently skips the test-user clause rather than raising a validation error.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb