Source: projects/identity-management/oim-kb-update/sandbox-db/2026-04-27-eset-it-shop-placement-and-flag-enforcement-db-evidence.md

> Source: projects/identity-management/oim-kb-update/sandbox-db/2026-04-27-eset-it-shop-placement-and-flag-enforcement-db-evidence.md

Goal

Capture how system roles (ESet) are wired into IT Shop availability in this sandbox at the database layer:

This is intended as troubleshooting evidence (why an ESet is not requestable / why a flag update fails).

Findings (summary)

Evidence

1) ESet has IT Shop flags + UID_AccProduct

Observed column list (subset relevant to IT Shop):

Query:

SELECT c.column_id, c.name AS ColumnName
FROM sys.columns c
WHERE c.object_id = OBJECT_ID('dbo.ESet')
ORDER BY c.column_id;

Snapshot (counts):

SELECT
  SUM(CASE WHEN IsForITShop = 1 THEN 1 ELSE 0 END) AS ESet_IsForITShop_True,
  SUM(CASE WHEN IsITShopOnly = 1 THEN 1 ELSE 0 END) AS ESet_IsITShopOnly_True,
  COUNT(*) AS ESet_Total
FROM ESet;

Result (2026-04-27):

2) Placement table: BaseTreeHasESet

The IT Shop placement link table for system roles is BaseTreeHasESet.

Columns:

UID_Org
UID_ESet
XTouched
XObjectKey
RiskIndexCalculated
XMarkedForDeletion
XOrigin
XDateInserted
XDateUpdated
XUserInserted
XUserUpdated
XIsInEffect

Query:

SELECT c.column_id, c.name AS ColumnName
FROM sys.columns c
WHERE c.object_id = OBJECT_ID('dbo.BaseTreeHasESet')
ORDER BY c.column_id;

3) IT Shop filtered view: ITShopOrgHasESet

ITShopOrgHasESet is a thin filter over BaseTreeHasESet that keeps only rows whose UID_Org is inside the IT Shop subtree (BaseTree.UID_OrgRoot = 'QER-V-ITShopOrg').

Definition (excerpted from sys.sql_modules):

create   view dbo.ITShopOrgHasESet as
 select
    RiskIndexCalculated as RiskIndexCalculated,
    UID_ESet as UID_ESet,
    UID_Org as UID_ITShopOrg,
    XDateInserted as XDateInserted,
    XDateUpdated as XDateUpdated,
    XIsInEffect as XIsInEffect,
    XMarkedForDeletion as XMarkedForDeletion,
    XObjectKey as XObjectKey,
    XOrigin as XOrigin,
    XTouched as XTouched,
    XUserInserted as XUserInserted,
    XUserUpdated as XUserUpdated
 from BaseTreeHasESet
 where exists (
   select top 1 1
   from BaseTree y
   where y.UID_Org = BaseTreeHasESet.UID_Org
     and y.UID_OrgRoot = 'QER-V-ITShopOrg'
 )

4) Flag enforcement: RMS_TUESet trigger

When ESet.IsForITShop or ESet.IsITShopOnly is updated, the trigger RMS_TUESet:

Snippet (from sys.sql_modules, around the flag checks):

if update(isForITShop) or update(isITShopOnly) begin
  declare @FlagTest QBM_YParameterlist
  insert into @FlagTest(Parameter1, Parameter2, HasContentFull, e.Parameter3)
    select i.UID_ESet, i.XObjectKey, i.IsForITShop, dbo.QBM_FCVBigIntToString(i.IsITShopOnly)
    from inserted i

  exec QER_PIsForITShopFlagCheck 'ESet', @FlagTest

  if exists (
    select top 1 1
    from inserted i
      join ESetHasEntitlement ehe on i.XObjectKey = ehe.Entitlement and ehe.XOrigin > 0
      join ESet e on ehe.uid_ESet = e.uid_Eset and e.IsITShopOnly = 0
    where i.IsForITShop = 1 and i.IsITShopOnly = 1
  ) begin
    raiserror('#LDS#Changes cannot take place, because assignments to system roles still exist that may not be used exclusively in IT Shop.|', 18, 2) with nowait
  end

  -- then: dynamic checks over entitlement tables that have IsForITShop/IsITShopOnly columns
end

Notes:

Open questions / next DB experiments