Get Active Directory user data or access¶
ActiveDirectoryServiceProxy wraps the ActiveDirectory SOAP service to answer three independent AD questions — a user's default printer, a cached role-access decision, and a mapped contact record — without exposing the generated clsADServicesSoapClient to callers.
| Field | Value |
|---|---|
| Operation ID | OP-WP-01 |
| Trigger | A caller request; no in-repository code constructs this wrapper |
| Inputs | userId, role, useExternalDomain |
| Outputs | A printer name, a boolean access decision, or a SAIF.Core.Contracts.Contact |
| Primary components | ActiveDirectoryServiceProxy.GetDefaultPrinter, ActiveDirectoryServiceProxy.HasAccess, ActiveDirectoryServiceProxy.GetContact |
| Entry point | Services/SAIF.Services.Web.Proxies/ActiveDirectoryServiceProxy.cs |
Steps¶
- Construct
ActiveDirectoryServiceProxy(serviceUrl): guardserviceUrlwithEnforce.ArgumentNotNullOrEmpty(WP-BR-001), then build a defaultBasicHttpBindingclient with no explicit security. - On failure: an argument exception is thrown before any wire client is created.
GetDefaultPrinter(userId): guarduserIdis not null or empty (WP-BR-001), then call the wireGetDefaultPrinteroperation and return its result unchanged.HasAccess(userId, role, useExternalDomain): (WP-BR-002)- If
useExternalDomainis true: call wireHasAccessCacheExternal(userId, role). - Otherwise: call wire
HasAccessCache(userId, role). - The boolean result is returned unchanged in both branches.
GetContact(userId): call wireGetUserInfo(userId), then map the returnedUSERINFOSTRUCTfields to aSAIF.Core.Contracts.Contact: (WP-BR-003)Address/City/State/ZipbecomePrimaryAddress.FaxNumberbecomesPrimaryFax.First/Last/MiddlebecomeName.TelephonebecomesPrimaryPhone.EmailandGenderare copied directly.- Every null field is coalesced to
"". - On failure: there is no null guard on
userId, and a nulluserInforeturned by the wire call throwsNullReferenceException. Dispose()callswebService.Close()on the generated client without anAbort()fallback on the fault path.
Process flow¶
The following diagram visualizes the three independent request paths through this wrapper.
flowchart TD
Start([Caller invokes wrapper method]) --> Which{Which method?}
Which -->|GetDefaultPrinter| GP[Guard userId] --> GPCall[Call wire GetDefaultPrinter] --> GPRet([Return printer name])
Which -->|HasAccess| HA{useExternalDomain?}
HA -->|Yes| HAExt[Call HasAccessCacheExternal] --> HARet([Return boolean])
HA -->|No| HAInt[Call HasAccessCache] --> HARet
Which -->|GetContact| GC[Call wire GetUserInfo] --> GCMap["Map USERINFOSTRUCT to Contact<br>(nulls become empty strings)"] --> GCRet([Return Contact])
Failure and edge-case behavior¶
- A null or empty
serviceUrloruserId(forGetDefaultPrinter) throws an argument exception before any wire call is made. - A null
userInforeturned fromGetUserInfothrowsNullReferenceExceptioninGetContact, because there is no null guard on the wire result. Dispose()callingClose()withoutAbort()can itself throw if the underlying channel has faulted*.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Related documentation¶
Sources¶
Services/SAIF.Services.Web.Proxies/ActiveDirectoryServiceProxy.cs