Retrieve the accessible policy list for a user¶
Builds the list of policies a given user is permitted to select from, dispatching to a different data source per user type: group/chapter book, safety-consultant book, agent/agency online list, or fee-auditor list. Policyholder users instead derive their list from their own affiliated-policy collection.
| Field | Value |
|---|---|
| Operation ID | op-08-retrieve-accessible-policy-list |
| Trigger | Caller reads clsPolicySecurity.PolicyList |
| Inputs | Current UserType/SecurityPrincipal |
| Outputs | List(Of strPolicyList) — each entry has PolicyNum, PolicyName, PolicyNameAndNumber |
| Primary components | PolicyList property, GetPolicyListForAgent, GetPolicyListforGroup, GetPolicyListForSafetyConsultant, GetPolicyListForFeeAuditor |
| Entry point | SAIF.Business.View.Policy/clsPolicySecurity.vb |
Steps¶
- The
PolicyListproperty is lazily populated (m_PolicyList Is Nothingguard) on first read, and dispatches onUserType.UserType(BR-VP-005): Agent→GetPolicyListForAgent(UserType.UserNumber, Not UserType.IsProducer()).PolicyHolder→ builds the list directly in-memory fromPolicyDataForUser.AffiliatedPolicyCollection, without an additional list-specific query (see Retrieve affiliated policies (legacy)).LossControl→GetPolicyListForSafetyConsultant(UserType.UserNumber.ToString).Group→GetPolicyListforGroup().Auditor→GetPolicyListForFeeAuditor(UserType.UserNumber.ToString).- Any other user type leaves
m_PolicyListunset; the getter then returns an emptyList(Of strPolicyList). GetPolicyListForAgentguards onIsNumeric(inAgentNum)before querying; executescp_get_agent_online_policy_list(SQL-027) on the SQL Server (BDS) portal, binding@AgentNumand@ForAgency(derived from "not a producer").GetPolicyListforGroupexecutescp_claimprofile_get_group_policy_list(SQL-025) on the BDS portal, binding@GroupKeyCode,@SpecificChapterCode, and@rptDate = Now; a code comment documents a special-case group whose chapter code is a regex-like bracketed exclusion pattern (HBA[^E]) rather than a literal chapter letter.GetPolicyListForSafetyConsultantexecutescp_claimprofile_get_sc_book(SQL-026) on the BDS portal, binding@losscontrolto the user number.GetPolicyListForFeeAuditorexecutes an inline-built SQL string fromGetAuditorPolicyListSQL()(SQL-028) on the primary (Oracle) portal asRequestType.ResultSet/CommandType.Text, bindingVendorNum; the SQL joinspa_audit,pa_auditor, andpolicy, filtering out cancelled/completed audits older than a rolling 60-day-forward window (sysdate + 60).- Each of the four query methods maps result rows into
strPolicyListstructures via the sameNew strPolicyList(policyNum, policyName)pattern, though the exact column names queried differ per source (policy_number/policy_namefor the group/SC-book/agent queries vs.POLICY_NUM/POLICY_NAMEfor the auditor query).
Process flow¶
flowchart TD
Start(["Caller reads<br>PolicySecurity.PolicyList"]) --> A{m_PolicyList<br>already populated?}
A -->|Yes| Return(["Return cached list"])
A -->|No| B{User type?}
B -->|Agent| C["cp_get_agent_online_policy_list<br>(BDS)"]
B -->|PolicyHolder| D["Build in-memory from<br>AffiliatedPolicyCollection"]
B -->|LossControl| E["cp_claimprofile_get_sc_book<br>(BDS)"]
B -->|Group| F["cp_claimprofile_get_group_policy_list<br>(BDS)"]
B -->|Auditor| G["Inline fee-auditor query<br>(Oracle)"]
B -->|Other| H["m_PolicyList left unset"]
C --> I["Map rows to strPolicyList"]
D --> I
E --> I
F --> I
G --> I
I --> Return
H --> J(["Return empty list"])
Failure and edge-case behavior¶
GetPolicyListForAgentsilently produces no list (leavesm_PolicyListunset, so the getter returns an empty list) ifinAgentNumis not numeric — no exception is raised.*- A user type not covered by the
Select Case(e.g.SaifEmployee,MCO,MedProv,Bookkeeper) receives an empty policy list from this property even thoughIsPolicyValidForUsergrants those types unconditional per-policy access — the two operations are not symmetric.* - The fee-auditor query's 60-day window uses
sysdate + 60on bothcancel_dateandcompleted_datebounds, which reads as a forward-looking window rather than the-60-day lookback used inCanAuditorAccessPolicyfor the single-policy authorization check — the two auditor-access queries do not use an identical time window.*
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.
Related documentation¶
Sources¶
SAIF.Business.View.Policy/clsPolicySecurity.vb