Switch active user context¶
LoadThisUser lets a caller redirect the object's active m_DirUser context to a different Active Directory account, reusing the already-bound m_DirServer connection. It is also used internally by UpdateUser (see Create or update an external user) to locate the account being edited before applying field changes.
| Field | Value |
|---|---|
| Operation ID | OP-SU-03 |
| Trigger | Caller calls clsSystemUser.LoadThisUser(InUserId) directly, or UpdateUser(...) calls it internally as its first step |
| Inputs | InUserId — the target user's ID |
| Outputs | Boolean result; on success, m_DirUser is replaced with the located clsUser instance |
| Primary components | clsSystemUser.LoadThisUser(...) |
| Entry point | Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb |
Steps¶
- Look up the target user.
LoadThisUsercallsm_DirServer.GetUser(InUserId)against the directory connection established at construction. - Handle a failed lookup. If the lookup returns
Nothing, the method returnsFalseand leaves the existingm_DirUsercontext untouched. - Switch the active context. If the lookup succeeds, the method sets
isOkay = Trueand replacesm_DirUserwith the locatedclsUserinstance. - Return the outcome. The method returns
Trueafter the switch, orFalseif the user could not be found.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller calls LoadThisUser with InUserId]) --> Lookup[m_DirServer.GetUser InUserId]
Lookup --> Found{User found?}
Found -->|No| Fail([Return False; m_DirUser unchanged])
Found -->|Yes| Switch[Replace m_DirUser with located clsUser]
Switch --> Ok([Return True])
Failure and edge-case behavior¶
- A failed lookup leaves the previous
m_DirUsercontext intact rather than clearing it, so a caller that ignores theFalsereturn value continues operating against the prior user's context.* - The method performs no validation on
InUserIdformat before the lookup; malformed IDs simply fail to resolve like any other unmatched ID.
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.
Sources¶
Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb