fix(grpc-data): A4 F4 — an admitted folder event item promotes a projected folder that materialised before its mapping was condition-bearing
OnProjectedFolderMaterialised promotes condition-bearing mapping folders to SubscribeToEvents only at materialisation, and IsConditionBearingMapping needs the mapping's authority active. On a freshly restarted consumer the projected pages materialise before that authority activates, and nothing re-promoted them, so a folder-first event item was refused BadNotSupported by the SDK (MonitoredNodeMonitoredItemManager checks EventNotifier) until an i=2253 item opened demand and a condition got wired there. SubscribeToEvents: once the projected-notifier admission (mapping gate) passes, PromoteProjectedEventFolder re-evaluates IsConditionBearingMapping and promotes the folder before the SDK attach. Unauthorized callers are refused before it. Test: F4_a_folder_materialised_before_its_mapping_was_condition_bearing_… (control: refused while not condition-bearing; red with the promotion removed).
This commit is contained in:
@@ -6567,6 +6567,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
|
||||
if (projectedNotifier is { } notifierId)
|
||||
{
|
||||
if (!ImportedNotifierAdmits(IdentityOf(context), notifierId)) return StatusCodes.BadUserAccessDenied;
|
||||
PromoteProjectedEventFolder(notifierId); // A4 F4: admitted ⇒ a notifier, even if it materialised before its authority
|
||||
}
|
||||
else if (SecurityFilteringActive && !unsubscribe
|
||||
&& IsHandleInNamespace(sourceId) is { } source
|
||||
|
||||
@@ -623,6 +623,27 @@ public sealed partial class OtOpcUaNodeManager : IProjectedConditionSink
|
||||
if (_importedConditions.Find(id) is { } c) WireImportedFolder(c, folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A4 F4: promotes, just before the SDK attaches an ADMITTED event item to it (and refuses a node without
|
||||
/// <c>SubscribeToEvents</c>, <c>BadNotSupported</c>), a materialised projected folder whose mapping was not yet
|
||||
/// condition-bearing when it materialised — its authority activates at the consumer's first barrier, after the projected
|
||||
/// pages were served. Nothing re-promoted it, so a folder-first client on a freshly restarted consumer was refused until an
|
||||
/// <c>i=2253</c> item opened demand and a condition got wired there. One dictionary probe; caller holds no lock.
|
||||
/// </summary>
|
||||
/// <param name="folderId">The projected notifier the item targets.</param>
|
||||
private void PromoteProjectedEventFolder(NodeId folderId)
|
||||
{
|
||||
if (ProjectedConditionAccess is not { } access) return;
|
||||
lock (Lock)
|
||||
{
|
||||
if (_importedConditions.PromotedFolders.Contains(folderId) || !_importedConditions.FolderKeys.TryGetValue(folderId, out var key)) return;
|
||||
if (!access.IsConditionBearingMapping(key.Mapping) || FindProjectedFolder(key) is not { } folder) return;
|
||||
_importedConditions.PromotedFolders.Add(folder.NodeId);
|
||||
folder.EventNotifier = (byte)(folder.EventNotifier | EventNotifiers.SubscribeToEvents);
|
||||
folder.ClearChangeMasks(SystemContext, includeChildren: false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A projected folder is being removed: unwire it symmetrically first (N7) and drop it from the index. Under Lock.</summary>
|
||||
private void OnProjectedFolderRemoving(NodeId folderId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user