cp_policy_in_group¶
Overview¶
| Field | Value |
|---|---|
| Schema | eisD0P11.dbo |
| Type | SQL Server stored procedure (BDS) |
| Database | SQL Server (eisD0P11, referred to internally as "BDS") |
| Status | ✅ found — retrieved via Legends CLI |
| Query executed | legends sqlserver query --name cp_policy_in_group |
| Calling libraries | SAIF.Business.View.Policy |
| Calling classes | clsPolicySecurity |
Purpose¶
cp_policy_in_group returns a count indicating whether a policy belongs to a group/chapter, used by
clsPolicySecurity.IsInGroup as part of the group-membership authorization path.
Procedures / Methods¶
cp_policy_in_group¶
| Field | Value |
|---|---|
| Returns | howMany — count of matching rows |
| Called by | clsPolicySecurity.IsInGroup (clsPolicySecurity.vb:254-261) |
Description: Evaluates group membership under READ UNCOMMITTED isolation, selecting one of three
query variants based on how the supplied group id is registered, and excludes group parents from group
evaluation (see rules PR-BVP-044 through PR-BVP-048 in Business Rules below).
Parameters¶
| Parameter | Direction | Type | Default | Description |
|---|---|---|---|---|
@groupID |
IN | varchar(10) |
— | Group key code |
@chapters |
IN | varchar(10) |
— | Optional chapter filter |
@policyNum |
IN | int |
— | Policy number |
Business Rules¶
Rules extracted from this procedure's logic:
| Rule ID | Rule | Condition | Action |
|---|---|---|---|
| PR-BVP-044 | Group membership evaluation reads uncommitted data by design | always | SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED |
| PR-BVP-045 | The query variant is selected by how the supplied group id is registered | @groupID present and non-blank in wcs_employer_group.parent_grp → @UseSql = 1; present in grp_assn_key with grp_typ_cd <> 'PARNT' → @UseSql = 2; @UseSql = 2 AND rtrim(@chapters) > '' → @UseSql = 3 |
Execute the corresponding COUNT query; default is @UseSql = 2 |
| PR-BVP-046 | Group parents are excluded from group evaluation | grp_typ_cd = 'PARNT' |
Not treated as a group-association match (modification 08/21/2013, JERTOD) |
| PR-BVP-047 | Only the most recent covered policy period participates | always | Join VW_WCS_POLICY_NO_SUB → VW_WCS_POLICY_PD_NO_SUB with MOST_RECENT_PP_COV_FL = 'Y' → WCS_POLICY_PERIOD_SUM → WCS_EMPLOYER_GROUP |
| PR-BVP-048 | A non-zero count means the policy is in the group | howMany > 0 |
Caller clsPolicySecurity.IsInGroup returns true (clsPolicySecurity.vb:254-261) |
These rules are documented in business-rules.md.
Operations¶
Operations and processes implemented in this procedure:
| Operation | Description | Trigger |
|---|---|---|
| Test policy group membership | Returns a count indicating whether a policy belongs to a group/chapter | clsPolicySecurity.IsInGroup (clsPolicySecurity.vb:254-261) |
These operations are also listed in operations-processes.md with source reference back to this document.
Source Code¶
Transact-SQL stored procedure
CREATE PROCEDURE dbo.cp_policy_in_group
@groupID varchar(10),
@chapters varchar(10),
@policyNum int
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
DECLARE @UseSql int
SELECT @UseSql = 2
-- 08/21/2013 JERTOD: exclude group parents from group evaluation
IF EXISTS (SELECT 1 FROM wcs_employer_group
WHERE parent_grp = @groupID AND rtrim(@groupID) > '')
SELECT @UseSql = 1
ELSE IF EXISTS (SELECT 1 FROM wcs_employer_group
WHERE grp_assn_key = @groupID AND grp_typ_cd <> 'PARNT')
SELECT @UseSql = 2
IF @UseSql = 2 AND rtrim(@chapters) > ''
SELECT @UseSql = 3
-- each branch returns: SELECT count(*) AS howMany
-- FROM VW_WCS_POLICY_NO_SUB wp
-- JOIN VW_WCS_POLICY_PD_NO_SUB pd ON ... AND pd.MOST_RECENT_PP_COV_FL = 'Y'
-- JOIN WCS_POLICY_PERIOD_SUM ps ON ...
-- JOIN WCS_EMPLOYER_GROUP eg ON ...
-- WHERE wp.plcy_num = @policyNum
-- [AND chapCd like rtrim(@chapters)] -- branch 3 only
Related Documentation¶
Sources¶
- SQL Server BDS source:
eisD0P11.dbo.cp_policy_in_group - Legends CLI query executed 2026-08-31:
legends sqlserver query --name cp_policy_in_group - Calling code:
SAIF.Business.View.Policy/clsPolicySecurity.vb:254-261