Skip to content

ChangeUserAccount (OP-09)

Request and response

Part Type Description
inUserId String The SamAccountName of the account to update.
inGivenName String Written to GivenName only when non-empty, setting modified = True.
inSurName String Written to Surname only when non-empty, setting modified = True.
inDescription String Written to Description only when non-empty, setting modified = True.
inPhoneNum String Written to telephoneNumber only when non-empty, setting modified = True.
inMailAddr String Written to mail only when non-empty, setting modified = True.
inTitle String Written to title only when non-empty, setting modified = True.
inInfo String Written to info only when non-empty; does not set modified.
inCompany String Written to company only when non-empty; does not set modified.
inFAXNum String Written to facsimileTelephoneNumber only when non-empty, setting modified = True.
Part Type Description
<return> ADServiceResponse Response is Success, UserDoesNotExist, or Failure. Message carries the caught exception text on a Failure, otherwise empty.

WebMethod attributes

<WebMethod()> — bare, no arguments supplied.

Steps

  1. CheckAccess(); on denial return AccessDenied() (BR-01).
  2. Call H1 GetContext for the external domain.
  3. Initialize the response sentinel to Success; set local modified = False.
  4. Open Try.
  5. UserPrincipal.FindByIdentity(prinContext, inUserId) directly — this operation does not use H2, so a Nothing context would fault here rather than being swallowed*.
  6. If Nothing, set Response = UserDoesNotExist.
  7. Else set GivenName, Surname, and Description only when the matching input is non-empty, setting modified = True for each write (BR-23).
  8. If modified, call userPrin.Save().
  9. Reset modified = False; de = userPrin.GetUnderlyingObject.
  10. Write company (without setting modified — tech debt TD-19), telephoneNumber, mail, title, info (without setting modified — tech debt TD-19), and facsimileTelephoneNumber, each only when the matching input is non-empty (BR-13).
  11. If modified, call de.CommitChanges() (BR-24) — a request that changes only inCompany and/or inInfo returns Success having committed nothing (tech debt TD-19, HIGH — see Tech debt).
  12. Catch ex As Exception → set Response = Failure, Message = ex.Message.
  13. Finally releases de, prinContext, and userPrin.
  14. Return the response sentinel.

Process flow

flowchart TD
    A["Call ChangeUserAccount"] --> B{"CheckAccess<br>HasAccess?"}
    B -->|"No"| C["Return AccessDenied"]
    B -->|"Yes"| D["FindByIdentity direct<br>no H2 wrapper"]
    D -->|"Nothing"| E["Set UserDoesNotExist"]
    D -->|"Found"| F["Set GivenName/Surname<br>Description if non-empty"]
    F --> G{"modified?"}
    G -->|"Yes"| H["userPrin.Save"]
    G -->|"No"| I["Skip Save"]
    H --> J["Reset modified = False"]
    I --> J
    J --> K["Write company/info<br>without setting modified"]
    K --> L["Write phone/mail/title/fax<br>setting modified"]
    L --> M{"modified?"}
    M -->|"Yes"| N["de.CommitChanges"]
    M -->|"No"| O["Skip CommitChanges<br>company/info silently lost"]
    N --> P["Return response"]
    O --> P
    E --> P
    D -.->|"Exception"| Q["Set Failure + ex.Message"]
    Q --> P

Shared state effects

None — this operation touches no process-wide state; all locals are per-request.

Error handling

The operation returns a sentinel ADServiceResponse for every outcome inside the Try block. It never surfaces a framework SOAP fault from a caught failure, but because FindByIdentity is called directly rather than through H2, a Nothing context (rather than a resolvable-vs-unresolvable user) would still be caught by the same Try/Catch and reported as Failure*. See Faults for the service-wide fault model.

Authorization

Gated by BR-01: the caller must pass the IP allow-list check enforced by CheckAccess. See Authentication and authorization.

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

  • src\ADUserServices\clsADUserServices.asmx.vb (lines 388-469)