Back to OIM Explorer

dbo.LDP_ZAccountInLDAPGroup

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 9.602 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.

Relations

  • No extracted relations.

Typed Edges

  • references source dbo.QER_FTAccountInheritFromOrg_L source text reference
  • references source dbo.DPR_FGIProjectionRootRunning source text reference
  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • references source dbo.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QBM_FGIModuleExists source text reference
  • references source dbo.TSB_FGIGroupAccountMatching source text reference
  • references source dbo.TSB_FGIUserInGroupValid source text reference
  • references source dbo.TSB_FGIUserInGroupValid_OVR source text reference
  • references source dbo.TSB_FGIUserInGroupValid_OVR_Ke source text reference
  • references source dbo.DPR_PSlotResetWhileProj_L source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PMNTableInsert source text reference
  • references source dbo.QBM_PMNTableOriginUpdate source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL361 lines
1CREATE PROCEDURE LDP_ZAccountInLDAPGroup(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @GenProcID varchar(38)10  DECLARE @PersonToCheck_L QBM_YSingleGUID11  DECLARE @UID_BaseTreeAssignToUse varchar(38) = 'LDP-AsgnBT-LDAPGroup'12  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent13  DECLARE @ObjectKeysToCheck_Projection QBM_YParameterList14  DECLARE @RowsToReset int15  DECLARE @MyName nvarchar(64) = object_name(@@procid)16  DECLARE @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',17  0)18  DECLARE @QBM_BitPatternXOrigin_Inherit int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',19  0)20  DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',21  1)22  DECLARE @PMDKeepMembershipsOfLinkedAccount varchar(16) =23  LEFT(dbo.QBM_FGIConfigparmValue('QER\Person\User\KeepMembershipsOfLinkedAccount'),24  16)25  DECLARE @QBM_BitPatternXMarkedForDel_Out int = dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|',26  0)27  BEGIN TRY28    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,29    UID_Parameter,30    UID_SubParameter,31    GenProcID)32    SELECT33      UID_DialogDBQueue,34      UID_Parameter,35      UID_SubParameter,36      GenProcID37    FROM QBMDBQueueCurrent cu38      WITH(readpast)39    WHERE40      cu.SlotNumber = @SlotNumber41    IF @@rowcount = 042    BEGIN43      GOTO EndLabel44    END45    INSERT INTO @PersonToCheck_L(UID_SingleGuid)46    SELECT47      DISTINCT a.UID_Person48    FROM @DBQueueCurrent cu49    JOIN LDAPAccount a50      ON cu.UID_Parameter = a.UID_LDAPAccount51    WHERE52      a.UID_Person > ' '53    INSERT INTO @SourceData(IsUpcommingContent,54    XOriginAfter,55    Element,56    AssignedElement,57    XOriginBefore,58    XIsInEffectBefore,59    XIsInEffectAfter)60    SELECT61      0,62      0,63      aig.UID_LDAPAccount,64      aig.UID_LDAPGroup,65      aig.XOrigin,66      aig.XIsInEffect,67      068    FROM LDAPAccountInLDAPGroup aig69    JOIN @DBQueueCurrent x70      ON UID_LDAPAccount = x.UID_parameter71    JOIN LDAPGroup g72      ON aig.uid_LDAPGroup = g.uid_LDAPgroup AND g.IsDynamicGroup = 073    WHERE74      aig.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 AND g.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out = 075    INSERT INTO @SourceData(IsUpcommingContent,76    XOriginBefore,77    XOriginAfter,78    Element,79    AssignedElement,80    XIsInEffectBefore,81    XIsInEffectAfter)82    SELECT83      1,84      0,85      aig.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv,86      aig.UID_LDAPAccount,87      aig.UID_LDAPGroup,88      0,89      dbo.TSB_FGIUserInGroupValid_OVR_Ke(p.IsInActive,90      p.IsTemporaryDeactivated,91      p.XMarkedForDeletion,92      bh.PFDInheritGroup,93      bh.PTDInheritGroup,94      bh.PMDInheritGroup,95      1,96      p.IsSecurityIncident,97      bh.PSIInheritGroup,98      n.AccountDisabled,99      bh.ADAInheritGroup,100      ovr.PFDInheritOverwrite,101      ovr.PTDInheritOverwrite,102      ovr.PSIInheritOverwrite,103      ovr.PMDInheritOverwrite,104      ovr.ADAInheritOverwrite,105      @PMDKeepMembershipsOfLinkedAccount)106    FROM LDAPAccountInLDAPGroup aig107    JOIN @DBQueueCurrent x108      ON aig.UID_LDAPAccount = x.UID_parameter109    JOIN LDAPGroup g110      ON aig.uid_LDAPGroup = g.uid_LDAPgroup AND g.IsDynamicGroup = 0 AND g.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out = 0111    JOIN LDAPAccount n112      ON aig.UID_LDAPAccount = n.UID_LDAPAccount113    JOIN LDPDomain d114      ON n.UID_LDPDomain = d.UID_LDPDomain115    LEFT116    OUTER117    JOIN TSBSpecificGroupBehavior ovr118      ON ovr.ObjectKeyGroup = g.XObjectKey119    LEFT120    OUTER121    JOIN person p122      ON n.UID_person = p.UID_person123    LEFT124    OUTER125    JOIN TSBBehavior bh126      ON n.UID_TSBBehavior = bh.UID_TSBBehavior127    INSERT INTO @SourceData(IsUpcommingContent,128    XOriginBefore,129    Element,130    AssignedElement,131    XOriginAfter,132    XIsInEffectBefore,133    XIsInEffectAfter)134    SELECT135      1,136      0,137      x.UID_LDAPAccount,138      x.UID_LDAPGroup,139      @QBM_BitPatternXOrigin_Inherit,140      0,141      dbo.TSB_FGIUserInGroupValid_OVR_Ke(p.IsInActive,142      p.IsTemporaryDeactivated,143      p.XMarkedForDeletion,144      bh.PFDInheritGroup,145      bh.PTDInheritGroup,146      bh.PMDInheritGroup,147      0,148      p.IsSecurityIncident,149      bh.PSIInheritGroup,150      x.AccountDisabled,151      bh.ADAInheritGroup,152      ovr.PFDInheritOverwrite,153      ovr.PTDInheritOverwrite,154      ovr.PSIInheritOverwrite,155      ovr.PMDInheritOverwrite,156      ovr.ADAInheritOverwrite,157      @PMDKeepMembershipsOfLinkedAccount)158    FROM(159    SELECT160      nt.UID_LDAPAccount,161      ohg.UID_LDAPGroup,162      nt.UID_LDPDomain,163      nt.UID_person,164      nt.AccountDisabled,165      nt.UID_TSBAccountDef,166      nt.UID_TSBBehavior,167      gg.XObjectKey168    FROM LDAPAccount nt169    JOIN @DBQueueCurrent x170      ON nt.UID_LDAPAccount = x.UID_parameter AND nt.isGroupAccount = 1171    JOIN dbo.QER_FTAccountInheritFromOrg_L(@PersonToCheck_L, @UID_BaseTreeAssignToUse) pfo172      ON pfo.UID_Person = nt.UID_Person173    JOIN BaseTreeHasLDAPGroup ohg174      ON ohg.uid_org = pfo.UID_Org AND ohg.XOrigin > 0 AND ohg.XIsInEffect = 1175    JOIN LDAPGroup gg176      ON ohg.UID_LDAPGroup = gg.UID_LDAPGroup AND gg.IsDynamicGroup = 0 AND gg.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out = 0 AND(nt.UID_LDPDomain177    = gg.UID_LDPDomain)178    WHERE179      dbo.TSB_FGIGroupAccountMatching(gg.MatchPatternForMembership, nt.MatchPatternForMembership) = 1180    UNION all181    SELECT182      nt.UID_LDAPAccount,183      gg.UID_LDAPGroup,184      nt.UID_LDPDomain,185      nt.UID_person,186      nt.AccountDisabled,187      nt.UID_TSBAccountDef,188      nt.UID_TSBBehavior,189      gg.XObjectKey190    FROM LDAPAccount nt191    JOIN @DBQueueCurrent x192      ON nt.UID_LDAPAccount = x.UID_parameter AND nt.isGroupAccount = 1193    JOIN person px194      ON nt.uid_person = px.uid_person AND px.isNoInherite = 0195    JOIN personHasESet phe196      ON nt.UID_person = phe.UID_person AND phe.XOrigin > 0 AND phe.XIsInEffect = 1197    JOIN ESetHasEntitlement ehe198      ON phe.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 0 AND ehe.XIsInEffect = 1 AND dbo.QBM_FGIModuleExists('RMS') = 1199    JOIN LDAPGroup gg200      ON ehe.entitlement = gg.XObjectKey AND gg.IsDynamicGroup = 0 AND gg.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out = 0 AND(nt.UID_LDPDomain201    = gg.UID_LDPDomain)202    WHERE203      dbo.TSB_FGIGroupAccountMatching(gg.MatchPatternForMembership, nt.MatchPatternForMembership) = 1) AS x204    JOIN LDPDomain d205      ON x.UID_LDPDomain = d.UID_LDPDomain206    LEFT207    OUTER208    JOIN TSBSpecificGroupBehavior ovr209      ON ovr.ObjectKeyGroup = x.XObjectKey210    LEFT211    OUTER212    JOIN person p213      ON x.UID_person = p.UID_person214    LEFT215    OUTER216    JOIN TSBBehavior bh217      ON x.UID_TSBBehavior = bh.UID_TSBBehavior218    WHERE219      (NOT(isnull(p.XMarkedForDeletion, 0) & @QBM_BitPatternXMarkedForDel_Delay > 0 AND bh.PMDInheritGroup IS NULL AND @PMDKeepMembershipsOfLinkedAccount220    <> 'ALL' AND ovr.PMDInheritOverwrite IS NULL))221    IF 1 = dbo.DPR_FGIProjectionRootRunning('LDPDomain')222    BEGIN223      INSERT INTO @ObjectKeysToCheck_Projection(Parameter1,224      Parameter2)225      SELECT226        cu.UID_Parameter,227        ro.ObjectKeyRoot228      FROM @DBQueueCurrent cu229      JOIN @Sourcedata sd230        ON cu.UID_Parameter = sd.Element231      JOIN LDAPGroup g232        ON sd.AssignedElement = g.UID_LDAPGroup233      JOIN LDP_VElementAndRoot ro234        ON g.XObjectKey = ro.ObjectKeyElement235      JOIN LDAPAccount a236        ON cu.UID_Parameter = a.UID_LDAPAccount AND a.UID_LDPDomain <> g.UID_LDPDomain237      WHERE238        ro.ElementTable = 'LDAPGroup'239      EXEC @RowsToReset = DPR_PSlotResetWhileProj_L @DBQueueCurrent,240        @ObjectKeysToCheck_Projection,241        @MyName,242        @SlotNumber243      IF @RowsToReset > 0244      BEGIN245        DELETE @DBQueueCurrent246        FROM @DBQueueCurrent cu247        LEFT248        OUTER249        JOIN QBMDBQueueCurrent d250          WITH(readpast)251          ON cu.UID_DialogDBQueue = d.UID_DialogDBQueue AND d.SlotNumber = @SlotNumber252        WHERE253          d.UID_DialogDBQueue IS NULL254        DELETE @Sourcedata255        FROM @Sourcedata s256        LEFT257        OUTER258        JOIN @DBQueueCurrent cu259          ON s.Element = cu.UID_Parameter260        WHERE261          cu.UID_DialogDBQueue IS NULL262      END263    END264    IF dbo.QBM_FGIConfigparmValue('QER\Structures\Inherite\GroupExclusion') > ' '265    BEGIN266      IF EXISTS(267        SELECT TOP 1 1268        FROM LDAPGroupExclusion ex269        WITH(nolock)270      JOIN @Sourcedata s271        ON ex.UID_LDAPGroupLower = s.AssignedElement272      WHERE273        s.IsUpcommingContent = 1 AND s.XOriginAfter > 0 AND s.XIsInEffectAfter = 1)274      BEGIN275        DECLARE @ExcludeCandidate QER_YExcludeCandidate276        INSERT INTO @ExcludeCandidate(Element,277        AssignedElement,278        XIsInEffectAfter)279        SELECT280          s.Element,281          s.AssignedElement,282          1283        FROM @Sourcedata s284        JOIN(285        SELECT exe.UID_LDAPGroupLower AS UID_Excluded286        FROM LDAPGroupExclusion exe) AS ex287          ON s.AssignedElement = ex.UID_Excluded288        WHERE289          s.IsUpcommingContent = 1 AND s.XOriginAfter > 0 AND s.XIsInEffectAfter = 1290        UNION all291        SELECT292          s.Element,293          s.AssignedElement,294          1295        FROM @Sourcedata s296        JOIN(297        SELECT exe.UID_LDAPGroupHigher AS UID_Excluding298        FROM LDAPGroupExclusion exe) AS ex299          ON s.AssignedElement = ex.UID_Excluding300        WHERE301          s.IsUpcommingContent = 1 AND s.XOriginAfter > 0 AND s.XIsInEffectAfter = 1302        UPDATE @ExcludeCandidate303        SET XIsInEffectAfter = 0304        FROM @ExcludeCandidate l305        JOIN(306        SELECT307          exe.UID_LDAPGroupLower AS UID_Excluded,308          exe.UID_LDAPGroupHigher AS UID_Excluding309        FROM LDAPGroupExclusion exe) AS ex310          ON l.AssignedElement = ex.UID_Excluded311        JOIN(312        SELECT sh.*313        FROM @ExcludeCandidate sh) AS h314          ON l.Element = h.Element AND h.AssignedElement = ex.UID_Excluding315        IF @@ROWCOUNT > 0316        BEGIN317          UPDATE @Sourcedata318          SET XIsInEffectAfter = 0319          FROM @Sourcedata l320          JOIN @ExcludeCandidate k321            ON l.Element = k.Element AND l.AssignedElement = k.AssignedElement AND k.XIsInEffectAfter = 0322          WHERE323            l.IsUpcommingContent = 1 AND l.XOriginAfter > 0 AND l.XIsInEffectAfter = 1324        END325      END326    END327    EXEC QBM_PDBQueueCalculateDelta @SourceData,328      @DeltaQuantity = 0,329      @DeltaDelete = 0,330      @DeltaInsert = 1,331      @DeltaOrigin = 1,332      @CountDeltaQantity = @CountDeltaQantity OUTPUT,333      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,334      @UseIsInEffect = 1,335      @SlotNumber = @SlotNumber,336      @DBQueueCurrentExtern = @DBQueueCurrent337    IF @CountDeltaOrigin > 0338    BEGIN339      EXEC QBM_PMNTableOriginUpdate 'LDAPAccountInLDAPGroup',340      'UID_LDAPAccount',341      'UID_LDAPGroup'342    END343    IF @CountDeltaQantity > 0344    BEGIN345      EXEC QBM_PMNTableInsert 'LDAPAccountInLDAPGroup',346      'UID_LDAPAccount',347      'UID_LDAPGroup',348        @TargetIsView = 0,349        @FKTableNameElement = 'LDAPAccount',350        @FKColumnNameElement = 'UID_LDAPAccount'351    END352  END TRY353  BEGIN CATCH354    EXEC QBM_PSessionErrorAdd DEFAULT355    RAISERROR('',356    18,357    1)358      WITH NOWAIT359  END CATCH360  endLabel:361END
Open raw exported source
SQL ยท Raw61 lines
1       create   procedure LDP_ZAccountInLDAPGroup (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @GenProcID varchar(38) declare @PersonToCheck_L QBM_YSingleGUID declare @UID_BaseTreeAssignToUse varchar(38) = 'LDP-AsgnBT-LDAPGroup' declare3 @DBQueueCurrent QBM_YDBQueueCurrent declare @ObjectKeysToCheck_Projection QBM_YParameterList declare @RowsToReset int declare @MyName nvarchar(64) = object_name4(@@procid) declare @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|', 0) declare @QBM_BitPatternXOrigin_Inherit int5 = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 0) declare @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 1) declare @PMDKeepMembershipsOfLinkedAccount6 varchar(16) = left(dbo.QBM_FGIConfigparmValue('QER\Person\User\KeepMembershipsOfLinkedAccount'), 16) declare @QBM_BitPatternXMarkedForDel_Out int = dbo.QBM_FGIBitPatternXMarkedForDel7('|OutStanding|', 0)  BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter8, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end insert9 into @PersonToCheck_L(UID_SingleGuid) select distinct a.UID_Person from @DBQueueCurrent cu join LDAPAccount a on cu.UID_Parameter = a.UID_LDAPAccount 10where a.UID_Person > ' '   insert into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore , XIsInEffectBefore, XIsInEffectAfter11 ) select 0, 0 , aig.UID_LDAPAccount, aig.UID_LDAPGroup, aig.XOrigin , aig.XIsInEffect , 0 from LDAPAccountInLDAPGroup aig join @DBQueueCurrent x on UID_LDAPAccount12 = x.UID_parameter join LDAPGroup g on aig.uid_LDAPGroup = g.uid_LDAPgroup and g.IsDynamicGroup = 0  where aig.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay13 = 0  and g.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out = 0  insert into @SourceData( IsUpcommingContent, XOriginBefore, XOriginAfter , Element14, AssignedElement , XIsInEffectBefore, XIsInEffectAfter ) select 1, 0, aig.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv , aig.UID_LDAPAccount, aig.UID_LDAPGroup15 , 0, dbo.TSB_FGIUserInGroupValid_OVR_Ke ( p.IsInActive, p.IsTemporaryDeactivated, p.XMarkedForDeletion, bh.PFDInheritGroup, bh.PTDInheritGroup, bh.PMDInheritGroup16, 1, p.IsSecurityIncident, bh.PSIInheritGroup, n.AccountDisabled, bh.ADAInheritGroup , ovr.PFDInheritOverwrite, ovr.PTDInheritOverwrite, ovr.PSIInheritOverwrite17, ovr.PMDInheritOverwrite, ovr.ADAInheritOverwrite, @PMDKeepMembershipsOfLinkedAccount)  from LDAPAccountInLDAPGroup aig join @DBQueueCurrent x on aig.UID_LDAPAccount18 = x.UID_parameter join LDAPGroup g on aig.uid_LDAPGroup = g.uid_LDAPgroup and g.IsDynamicGroup = 0  and g.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out19 = 0  join LDAPAccount n on aig.UID_LDAPAccount = n.UID_LDAPAccount  join LDPDomain d on n.UID_LDPDomain = d.UID_LDPDomain left outer join TSBSpecificGroupBehavior20 ovr on ovr.ObjectKeyGroup = g.XObjectKey  left outer join person p on n.UID_person = p.UID_person  left outer join TSBBehavior bh on n.UID_TSBBehavior21 = bh.UID_TSBBehavior  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter , XIsInEffectBefore, XIsInEffectAfter22 ) select 1, 0 , x.UID_LDAPAccount, x.UID_LDAPGroup, @QBM_BitPatternXOrigin_Inherit , 0, dbo.TSB_FGIUserInGroupValid_OVR_Ke ( p.IsInActive, p.IsTemporaryDeactivated23, p.XMarkedForDeletion, bh.PFDInheritGroup, bh.PTDInheritGroup, bh.PMDInheritGroup, 0, p.IsSecurityIncident, bh.PSIInheritGroup, x.AccountDisabled, bh.ADAInheritGroup24 , ovr.PFDInheritOverwrite, ovr.PTDInheritOverwrite, ovr.PSIInheritOverwrite, ovr.PMDInheritOverwrite, ovr.ADAInheritOverwrite, @PMDKeepMembershipsOfLinkedAccount25)  from (  select nt.UID_LDAPAccount , ohg.UID_LDAPGroup , nt.UID_LDPDomain , nt.UID_person, nt.AccountDisabled , nt.UID_TSBAccountDef , nt.UID_TSBBehavior26, gg.XObjectKey from LDAPAccount nt join @DBQueueCurrent x on nt.UID_LDAPAccount = x.UID_parameter   and nt.isGroupAccount = 1 join dbo.QER_FTAccountInheritFromOrg_L27(@PersonToCheck_L , @UID_BaseTreeAssignToUse ) pfo on pfo.UID_Person = nt.UID_Person join BaseTreeHasLDAPGroup ohg on ohg.uid_org = pfo.UID_Org and ohg.XOrigin28 > 0 and ohg.XIsInEffect = 1 join LDAPGroup gg on ohg.UID_LDAPGroup = gg.UID_LDAPGroup and gg.IsDynamicGroup = 0  and gg.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out29 = 0   and ( nt.UID_LDPDomain = gg.UID_LDPDomain     )  where dbo.TSB_FGIGroupAccountMatching( gg.MatchPatternForMembership, nt.MatchPatternForMembership30) = 1  union all select nt.UID_LDAPAccount , gg.UID_LDAPGroup , nt.UID_LDPDomain , nt.UID_person , nt.AccountDisabled , nt.UID_TSBAccountDef , nt.UID_TSBBehavior31, gg.XObjectKey from LDAPAccount nt join @DBQueueCurrent x on nt.UID_LDAPAccount = x.UID_parameter   and nt.isGroupAccount = 1  join person px on nt.uid_person32 = px.uid_person and px.isNoInherite = 0  join personHasESet phe on nt.UID_person = phe.UID_person and phe.XOrigin > 0 and phe.XIsInEffect = 1 join ESetHasEntitlement33 ehe on phe.uid_ESet = ehe.uid_ESet and ehe.XOrigin > 0 and ehe.XIsInEffect = 1 and dbo.QBM_FGIModuleExists('RMS') = 1 join LDAPGroup gg on ehe.entitlement34 = gg.XObjectKey and gg.IsDynamicGroup = 0  and gg.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Out = 0   and ( nt.UID_LDPDomain = gg.UID_LDPDomain35     )  where dbo.TSB_FGIGroupAccountMatching( gg.MatchPatternForMembership, nt.MatchPatternForMembership) = 1 ) as x join LDPDomain d on x.UID_LDPDomain36 = d.UID_LDPDomain left outer join TSBSpecificGroupBehavior ovr on ovr.ObjectKeyGroup = x.XObjectKey  left outer join person p on x.UID_person = p.UID_person37  left outer join TSBBehavior bh on x.UID_TSBBehavior = bh.UID_TSBBehavior   where (not (isnull(p.XMarkedForDeletion, 0) & @QBM_BitPatternXMarkedForDel_Delay38 > 0 and bh.PMDInheritGroup is null and @PMDKeepMembershipsOfLinkedAccount <> 'ALL' and ovr.PMDInheritOverwrite is null ) )  if 1 = dbo.DPR_FGIProjectionRootRunning39 ('LDPDomain') begin insert into @ObjectKeysToCheck_Projection(Parameter1, Parameter2) select cu.UID_Parameter, ro.ObjectKeyRoot from @DBQueueCurrent cu40 join @Sourcedata sd on cu.UID_Parameter = sd.Element join LDAPGroup g on sd.AssignedElement = g.UID_LDAPGroup join LDP_VElementAndRoot ro on g.XObjectKey41 = ro.ObjectKeyElement  join LDAPAccount a on cu.UID_Parameter = a.UID_LDAPAccount and a.UID_LDPDomain <> g.UID_LDPDomain  where ro.ElementTable = 'LDAPGroup'42 exec @RowsToReset = DPR_PSlotResetWhileProj_L @DBQueueCurrent, @ObjectKeysToCheck_Projection, @MyName, @SlotNumber if @RowsToReset > 0 begin delete  @DBQueueCurrent43 from @DBQueueCurrent cu left outer join QBMDBQueueCurrent d with (readpast) on cu.UID_DialogDBQueue = d.UID_DialogDBQueue and d.SlotNumber = @SlotNumber44 where d.UID_DialogDBQueue is null delete  @Sourcedata from @Sourcedata s left outer join @DBQueueCurrent cu on s.Element = cu.UID_Parameter where cu.UID_DialogDBQueue45 is null end end if dbo.QBM_FGIConfigparmValue('QER\Structures\Inherite\GroupExclusion') > ' ' begin if exists (select top 1 1 from LDAPGroupExclusion 46ex with (nolock) join @Sourcedata s on ex.UID_LDAPGroupLower  = s.AssignedElement where s.IsUpcommingContent = 1 and s.XOriginAfter > 0 and s.XIsInEffectAfter47 = 1 ) begin declare @ExcludeCandidate QER_YExcludeCandidate insert into @ExcludeCandidate(Element, AssignedElement, XIsInEffectAfter) select s.Element48, s.AssignedElement, 1 from @Sourcedata s join ( select exe.UID_LDAPGroupLower as UID_Excluded from LDAPGroupExclusion exe ) as ex on s.AssignedElement49 = ex.UID_Excluded where s.IsUpcommingContent = 1 and s.XOriginAfter > 0 and s.XIsInEffectAfter = 1 union all select s.Element, s.AssignedElement, 1 from50 @Sourcedata s join ( select exe.UID_LDAPGroupHigher as UID_Excluding from LDAPGroupExclusion exe ) as ex on s.AssignedElement = ex.UID_Excluding where51 s.IsUpcommingContent = 1 and s.XOriginAfter > 0 and s.XIsInEffectAfter = 1 update @ExcludeCandidate set XIsInEffectAfter = 0 from @ExcludeCandidate l 52 join ( select exe.UID_LDAPGroupLower as UID_Excluded, exe.UID_LDAPGroupHigher as UID_Excluding from LDAPGroupExclusion exe ) as ex on l.AssignedElement53 = ex.UID_Excluded join (select sh.* from @ExcludeCandidate sh  ) as h on l.Element = h.Element and h.AssignedElement = ex.UID_Excluding if @@ROWCOUNT 54> 0 begin update @Sourcedata set XIsInEffectAfter = 0 from @Sourcedata l join @ExcludeCandidate k on l.Element = k.Element and l.AssignedElement = k.AssignedElement55 and k.XIsInEffectAfter = 0 where l.IsUpcommingContent = 1 and l.XOriginAfter > 0 and l.XIsInEffectAfter = 1 end end  end    exec QBM_PDBQueueCalculateDelta56 @SourceData, @DeltaQuantity = 0, @DeltaDelete = 0, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin57 = @CountDeltaOrigin output , @UseIsInEffect = 1 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent if @CountDeltaOrigin > 0 begin exec58 QBM_PMNTableOriginUpdate 'LDAPAccountInLDAPGroup', 'UID_LDAPAccount', 'UID_LDAPGroup' end if @CountDeltaQantity > 0 begin exec QBM_PMNTableInsert 'LDAPAccountInLDAPGroup'59, 'UID_LDAPAccount', 'UID_LDAPGroup', @TargetIsView = 0 , @FKTableNameElement = 'LDAPAccount' , @FKColumnNameElement = 'UID_LDAPAccount'  end END TRY BEGIN60 CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 61