Evaluate and cache AD resource access¶
Answers whether the current user holds a named Active Directory resource, checking a per-instance cache before delegating to the security principal.
| Field | Value |
|---|---|
| Operation ID | evaluate-and-cache-ad-resource-access |
| Trigger | A derived access class (e.g. ClaimUserAccess) is asked whether the current user holds a named AD resource |
| Inputs | One or more AD resource names; a clsSecurityPrincipal previously supplied via SetPrincipal |
| Outputs | Boolean authorization result; a populated per-instance cache |
| Primary components | UserAccess.CheckAccess, UserAccess.HasAccess, UserAccess.SetPrincipal |
| Entry point | SAIF.Application/UserAccess.vb |
Steps¶
- A derived access class calls
SetPrincipal(inPrincipal)to bind the identity; if this is skipped,HasAccessfails with a null-reference on the first uncached lookup.** HasAccess(inResourceName)lower-cases the resource name and probesm_AccessControl; a cache hit returns the storedBooleanimmediately (BR-APP-004).- A cache miss calls
m_Principal.IsAuthorized(inResourceName)(the framework appends the environment suffix to the resource name), caches the result, and returns it. CheckAccess(ParamArray inResourceName())loops the supplied names callingHasAccesson each purely to warm the cache; the loop variable is overwritten each iteration and then discarded, so the method returns no information to the caller.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start(["HasAccess<br>called"]) --> Bind["SetPrincipal bound<br>identity"]
Bind --> Cache{"Cached?"}
Cache -->|Yes| Return["Return cached<br>Boolean"]
Cache -->|No| Query["m_Principal.IsAuthorized"]
Query --> StoreCache["Cache result"]
StoreCache --> Return
Failure and edge-case behavior¶
- If
SetPrincipalwas never called, the first uncached lookup fails with a null-reference exception.** CheckAccesswarms the cache for multiple resource names but discards its own loop result, so it cannot be used to test a specific name's outcome.