Determine whether the current user may view a policy¶
The core authorization entry point of this library: determines whether the current
clsSecurityPrincipal/clsUserType may view a given policy, branching by user type and applying
per-type ownership, assignment, or group-membership checks.
| Field | Value |
|---|---|
| Operation ID | OP-VP-002 |
| Trigger | Caller invokes clsPolicySecurity.IsPolicyValidForUser(inPolicyData) (or the Decimal policy-number overload) |
| Inputs | clsPolicyData (or a policy number, resolved internally via Retrieve policy header data), current clsSecurityPrincipal/clsUserType |
| Outputs | Boolean hasAccess |
| Primary components | clsPolicySecurity.IsPolicyValidForUser, clsPolicySecurity.IsPolicyValidForParentPolicy |
| Entry point | SAIF.Business.View.Policy\clsPolicySecurity.vb |
Steps¶
- Caller constructs
clsPolicySecurity(SecurityPrincipal, DPI); the constructor immediately builds aclsUserTypefrom the principal and initializes a secondary SQL ServerIDataPortalInfoviaclsSQLDataLayer(reads config settingsBDS_USER,bdsDatabase,BDS_DATABASENAME— see Configuration settings). - Caller calls
IsPolicyValidForUser(inPolicyData)(or theDecimalpolicy-number overload, which first calls Retrieve policy header data and then delegates to the object overload). - Enforces BR-VP-002:
if the policy's
SecurePolicyCode = clsConstants.SAIFand the principal is not authorized for AD resourceSAIFpolicyInfo, access is denied outright regardless of user type. - On failure: return
Falseimmediately; no further branching by user type occurs. - Enforces BR-VP-003:
if
inPolicyData.IsValid = FalseorPolicyNum = 0, access is denied. - On failure: return
Falseimmediately. - Branches by
UserType.UserType: SaifEmployee,MCO,MedProv,Bookkeeper→ always granted (BR-VP-004).Agent→ granted if the user's number matchesinPolicyData.AgentNumorinPolicyData.Agency.AgencySeqNum(BR-VP-005).-
PolicyHolder→ delegates toIsPolicyValidForParentPolicy(BR-VP-006), which checks the association "Parents" list on the requesting user's ownclsPolicyData(UsersPolicyData) for a matching policy number, or a direct number match.UsersPolicyData.Associationsis populated viaAssociations\clsPolicyAssociationFactory.GetPolicyHeaderAssociations, which calls intoSAIF.Business.Policy'sIPolicyAssociationType/category grouping logic.
Origin: This delegation is to
SAIF.Business.Policy(an internal project reference, notframeworkDensity-tracked); the step sequence within that library was not traced further — out of scope for this library's analysis. -Group→ callsIsInGroup(BR-VP-007), a SQL Server stored-procedure scalar query (SQL-VP-033, aliased in code as"IsInGroup"). -LossControl→ looks up the assigned Loss Control Consultant team member for the policy (clsTeamAssignmentCollection.Item(TeamFunctions.LossControlConsultant)) and compares the (masked or unmasked) username prefix against the user's own number viaCanSafetyConsultantAccessPolicy(BR-VP-008). - If no team assignment exists: access is denied. -Auditor→ callsCanAuditorAccessPolicy(BR-VP-009), an inline Oracle SQL query (SQL-VP-037) joiningPA_AUDIT,PA_AUDITOR, andPA_POLICY_PERIODby vendor number and policy number, filtered on non-expired cancel/completed dates. 6. Outcome:Boolean hasAccess, returned to the caller (typically an MVC controller/action in the Legal front end) to permit or deny display of claim/policy detail.
Process flow¶
flowchart TD
Start([IsPolicyValidForUser invoked]) --> Secure{SecurePolicyCode = SAIF and not authorized for SAIFpolicyInfo?}
Secure -->|Yes| Deny1([Access denied])
Secure -->|No| Valid{Policy IsValid and PolicyNum <> 0?}
Valid -->|No| Deny2([Access denied])
Valid -->|Yes| Branch{UserType?}
Branch -->|SaifEmployee/MCO/MedProv/Bookkeeper| Grant1([Access granted])
Branch -->|Agent| AgentCheck{Agent/agency number match?}
AgentCheck -->|Yes| Grant2([Access granted])
AgentCheck -->|No| Deny3([Access denied])
Branch -->|PolicyHolder| ParentCheck{Own policy or parent affiliation match?}
ParentCheck -->|Yes| Grant3([Access granted])
ParentCheck -->|No| Deny4([Access denied])
Branch -->|Group| GroupCheck{IsInGroup returns positive count?}
GroupCheck -->|Yes| Grant4([Access granted])
GroupCheck -->|No| Deny5([Access denied])
Branch -->|LossControl| LCCheck{Assigned LC consultant matches user?}
LCCheck -->|Yes| Grant5([Access granted])
LCCheck -->|No| Deny6([Access denied])
Branch -->|Auditor| AuditCheck{Non-expired audit record for vendor/policy?}
AuditCheck -->|Yes| Grant6([Access granted])
AuditCheck -->|No| Deny7([Access denied])
Failure and edge-case behavior¶
- SAIF secure-policy check fails: access denied regardless of user type (BR-VP-002).
- Policy invalid or
PolicyNum = 0: access denied (BR-VP-003). - No loss-control team assignment exists for the policy: access denied for
LossControlusers.
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. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
SAIF.Business.View.Policy\clsPolicySecurity.vb