Skip to content

Check user existence

UserExists is a lightweight existence probe used before other operations (such as account creation) to determine whether a given user ID already has an Active Directory entry. It retries once with a SAIF\ prefix if the bare user ID does not resolve.

Field Value
Operation ID OP-SU-08
Trigger Caller calls clsSystemUser.UserExists(inUserId)
Inputs inUserId — the user ID to check
Outputs Boolean result
Primary components clsSystemUser.UserExists(...)
Entry point Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb

Steps

  1. Attempt the direct lookup. UserExists calls m_DirServer.GetUser(inUserId).
  2. Retry with a SAIF-domain prefix. If the direct lookup returns Nothing, the method retries with m_DirServer.GetUser("SAIF\" + inUserId).
  3. Evaluate existence. doesExist is set to True if either lookup resolved a non-Nothing clsUser instance.
  4. Return the outcome. The method returns doesExist.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller calls UserExists]) --> Direct[m_DirServer.GetUser inUserId]
    Direct --> DirectFound{Found?}
    DirectFound -->|Yes| Exists([Return True])
    DirectFound -->|No| Retry[m_DirServer.GetUser SAIF\ + inUserId]
    Retry --> RetryFound{Found?}
    RetryFound -->|Yes| Exists
    RetryFound -->|No| NotExists([Return False])

Failure and edge-case behavior

  • The SAIF\ retry only helps when the caller's ID was passed without a domain prefix and the account actually resides in the SAIF domain; a user that only exists under a different naming form (e.g., a UPN or a differently prefixed form) will not be found by either lookup.*
  • The method does not distinguish "user not found" from any underlying lookup error — both GetUser calls are assumed to return Nothing on failure rather than throwing.*

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